summaryrefslogtreecommitdiff
path: root/framework
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
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')
-rw-r--r--framework/source/helper/dockingareadefaultacceptor.cxx48
-rw-r--r--framework/source/layoutmanager/layoutmanager.cxx214
-rw-r--r--framework/source/layoutmanager/toolbarlayoutmanager.cxx250
-rw-r--r--framework/source/services/urltransformer.cxx52
-rw-r--r--framework/source/uiconfiguration/globalsettings.cxx40
-rw-r--r--framework/source/uiconfiguration/imagemanagerimpl.cxx128
-rw-r--r--framework/source/uielement/imagebuttontoolbarcontroller.cxx34
-rw-r--r--framework/source/uielement/menubarmanager.cxx336
-rw-r--r--framework/source/uifactory/factoryconfiguration.cxx32
-rw-r--r--framework/source/uifactory/uielementfactorymanager.cxx32
10 files changed, 581 insertions, 585 deletions
diff --git a/framework/source/helper/dockingareadefaultacceptor.cxx b/framework/source/helper/dockingareadefaultacceptor.cxx
index d167bc11157f..59a43a1e321a 100644
--- a/framework/source/helper/dockingareadefaultacceptor.cxx
+++ b/framework/source/helper/dockingareadefaultacceptor.cxx
@@ -64,32 +64,30 @@ sal_Bool SAL_CALL DockingAreaDefaultAcceptor::requestDockingAreaSpace( const css
// Try to "lock" the frame for access to taskscontainer.
css::uno::Reference< XFrame > xFrame( m_xOwner );
- if ( xFrame.is() )
- {
- css::uno::Reference< css::awt::XWindow > xContainerWindow( xFrame->getContainerWindow() );
- css::uno::Reference< css::awt::XWindow > xComponentWindow( xFrame->getComponentWindow() );
-
- if ( xContainerWindow.is() && xComponentWindow.is() )
- {
- css::uno::Reference< css::awt::XDevice > xDevice( xContainerWindow, css::uno::UNO_QUERY );
- // Convert relative size to output size.
- css::awt::Rectangle aRectangle = xContainerWindow->getPosSize();
- css::awt::DeviceInfo aInfo = xDevice->getInfo();
- css::awt::Size aSize ( aRectangle.Width - aInfo.LeftInset - aInfo.RightInset ,
- aRectangle.Height - aInfo.TopInset - aInfo.BottomInset );
-
- css::awt::Size aMinSize( 0, 0 ); // = xLayoutConstraints->getMinimumSize();
-
- // Check if request border space would decrease component window size below minimum size
- if ((( aSize.Width - RequestedSpace.X - RequestedSpace.Width ) < aMinSize.Width ) ||
- (( aSize.Height - RequestedSpace.Y - RequestedSpace.Height ) < aMinSize.Height ) )
- return false;
-
- return true;
- }
- }
+ if ( !xFrame.is() )
+ return false;
+
+ css::uno::Reference< css::awt::XWindow > xContainerWindow( xFrame->getContainerWindow() );
+ css::uno::Reference< css::awt::XWindow > xComponentWindow( xFrame->getComponentWindow() );
+
+ if ( !xContainerWindow.is() || !xComponentWindow.is() )
+ return false;
+
+ css::uno::Reference< css::awt::XDevice > xDevice( xContainerWindow, css::uno::UNO_QUERY );
+ // Convert relative size to output size.
+ css::awt::Rectangle aRectangle = xContainerWindow->getPosSize();
+ css::awt::DeviceInfo aInfo = xDevice->getInfo();
+ css::awt::Size aSize ( aRectangle.Width - aInfo.LeftInset - aInfo.RightInset ,
+ aRectangle.Height - aInfo.TopInset - aInfo.BottomInset );
+
+ css::awt::Size aMinSize( 0, 0 ); // = xLayoutConstraints->getMinimumSize();
+
+ // Check if request border space would decrease component window size below minimum size
+ if ((( aSize.Width - RequestedSpace.X - RequestedSpace.Width ) < aMinSize.Width ) ||
+ (( aSize.Height - RequestedSpace.Y - RequestedSpace.Height ) < aMinSize.Height ) )
+ return false;
- return false;
+ return true;
}
void SAL_CALL DockingAreaDefaultAcceptor::setDockingAreaSpace( const css::awt::Rectangle& BorderSpace )
diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx
index e02f57e4345e..0d1cc619da89 100644
--- a/framework/source/layoutmanager/layoutmanager.cxx
+++ b/framework/source/layoutmanager/layoutmanager.cxx
@@ -513,130 +513,130 @@ bool LayoutManager::readWindowStateData( const OUString& aName, UIElement& rElem
std::unique_ptr<GlobalSettings> &rGlobalSettings, bool &bInGlobalSettings,
const Reference< XComponentContext > &rComponentContext )
{
- if ( rPersistentWindowState.is() )
- {
- bool bGetSettingsState( false );
+ if ( !rPersistentWindowState.is() )
+ return false;
- SolarMutexClearableGuard aWriteLock;
- bool bGlobalSettings( bInGlobalSettings );
- if ( rGlobalSettings == nullptr )
- {
- rGlobalSettings.reset( new GlobalSettings( rComponentContext ) );
- bGetSettingsState = true;
- }
- GlobalSettings* pGlobalSettings = rGlobalSettings.get();
- aWriteLock.clear();
+ bool bGetSettingsState( false );
- try
+ SolarMutexClearableGuard aWriteLock;
+ bool bGlobalSettings( bInGlobalSettings );
+ if ( rGlobalSettings == nullptr )
+ {
+ rGlobalSettings.reset( new GlobalSettings( rComponentContext ) );
+ bGetSettingsState = true;
+ }
+ GlobalSettings* pGlobalSettings = rGlobalSettings.get();
+ aWriteLock.clear();
+
+ try
+ {
+ Sequence< PropertyValue > aWindowState;
+ if ( rPersistentWindowState->hasByName( aName ) && (rPersistentWindowState->getByName( aName ) >>= aWindowState) )
{
- Sequence< PropertyValue > aWindowState;
- if ( rPersistentWindowState->hasByName( aName ) && (rPersistentWindowState->getByName( aName ) >>= aWindowState) )
+ bool bValue( false );
+ for ( PropertyValue const & rProp : std::as_const(aWindowState) )
{
- bool bValue( false );
- for ( PropertyValue const & rProp : std::as_const(aWindowState) )
+ if ( rProp.Name == WINDOWSTATE_PROPERTY_DOCKED )
{
- if ( rProp.Name == WINDOWSTATE_PROPERTY_DOCKED )
- {
- if ( rProp.Value >>= bValue )
- rElementData.m_bFloating = !bValue;
- }
- else if ( rProp.Name == WINDOWSTATE_PROPERTY_VISIBLE )
- {
- if ( rProp.Value >>= bValue )
- rElementData.m_bVisible = bValue;
- }
- else if ( rProp.Name == WINDOWSTATE_PROPERTY_DOCKINGAREA )
- {
- ui::DockingArea eDockingArea;
- if ( rProp.Value >>= eDockingArea )
- rElementData.m_aDockedData.m_nDockedArea = eDockingArea;
- }
- else if ( rProp.Name == WINDOWSTATE_PROPERTY_DOCKPOS )
- {
- awt::Point aPoint;
- if (rProp.Value >>= aPoint)
- {
- //tdf#90256 repair these broken Docking positions
- if (aPoint.X < 0)
- aPoint.X = SAL_MAX_INT32;
- if (aPoint.Y < 0)
- aPoint.Y = SAL_MAX_INT32;
- rElementData.m_aDockedData.m_aPos = aPoint;
- }
- }
- else if ( rProp.Name == WINDOWSTATE_PROPERTY_POS )
- {
- awt::Point aPoint;
- if ( rProp.Value >>= aPoint )
- rElementData.m_aFloatingData.m_aPos = aPoint;
- }
- else if ( rProp.Name == WINDOWSTATE_PROPERTY_SIZE )
- {
- awt::Size aSize;
- if ( rProp.Value >>= aSize )
- rElementData.m_aFloatingData.m_aSize = aSize;
- }
- else if ( rProp.Name == WINDOWSTATE_PROPERTY_UINAME )
- rProp.Value >>= rElementData.m_aUIName;
- else if ( rProp.Name == WINDOWSTATE_PROPERTY_STYLE )
- {
- sal_Int32 nStyle = 0;
- if ( rProp.Value >>= nStyle )
- rElementData.m_nStyle = static_cast<ButtonType>( nStyle );
- }
- else if ( rProp.Name == WINDOWSTATE_PROPERTY_LOCKED )
- {
- if ( rProp.Value >>= bValue )
- rElementData.m_aDockedData.m_bLocked = bValue;
- }
- else if ( rProp.Name == WINDOWSTATE_PROPERTY_CONTEXT )
- {
- if ( rProp.Value >>= bValue )
- rElementData.m_bContextSensitive = bValue;
- }
- else if ( rProp.Name == WINDOWSTATE_PROPERTY_NOCLOSE )
+ if ( rProp.Value >>= bValue )
+ rElementData.m_bFloating = !bValue;
+ }
+ else if ( rProp.Name == WINDOWSTATE_PROPERTY_VISIBLE )
+ {
+ if ( rProp.Value >>= bValue )
+ rElementData.m_bVisible = bValue;
+ }
+ else if ( rProp.Name == WINDOWSTATE_PROPERTY_DOCKINGAREA )
+ {
+ ui::DockingArea eDockingArea;
+ if ( rProp.Value >>= eDockingArea )
+ rElementData.m_aDockedData.m_nDockedArea = eDockingArea;
+ }
+ else if ( rProp.Name == WINDOWSTATE_PROPERTY_DOCKPOS )
+ {
+ awt::Point aPoint;
+ if (rProp.Value >>= aPoint)
{
- if ( rProp.Value >>= bValue )
- rElementData.m_bNoClose = bValue;
+ //tdf#90256 repair these broken Docking positions
+ if (aPoint.X < 0)
+ aPoint.X = SAL_MAX_INT32;
+ if (aPoint.Y < 0)
+ aPoint.Y = SAL_MAX_INT32;
+ rElementData.m_aDockedData.m_aPos = aPoint;
}
}
+ else if ( rProp.Name == WINDOWSTATE_PROPERTY_POS )
+ {
+ awt::Point aPoint;
+ if ( rProp.Value >>= aPoint )
+ rElementData.m_aFloatingData.m_aPos = aPoint;
+ }
+ else if ( rProp.Name == WINDOWSTATE_PROPERTY_SIZE )
+ {
+ awt::Size aSize;
+ if ( rProp.Value >>= aSize )
+ rElementData.m_aFloatingData.m_aSize = aSize;
+ }
+ else if ( rProp.Name == WINDOWSTATE_PROPERTY_UINAME )
+ rProp.Value >>= rElementData.m_aUIName;
+ else if ( rProp.Name == WINDOWSTATE_PROPERTY_STYLE )
+ {
+ sal_Int32 nStyle = 0;
+ if ( rProp.Value >>= nStyle )
+ rElementData.m_nStyle = static_cast<ButtonType>( nStyle );
+ }
+ else if ( rProp.Name == WINDOWSTATE_PROPERTY_LOCKED )
+ {
+ if ( rProp.Value >>= bValue )
+ rElementData.m_aDockedData.m_bLocked = bValue;
+ }
+ else if ( rProp.Name == WINDOWSTATE_PROPERTY_CONTEXT )
+ {
+ if ( rProp.Value >>= bValue )
+ rElementData.m_bContextSensitive = bValue;
+ }
+ else if ( rProp.Name == WINDOWSTATE_PROPERTY_NOCLOSE )
+ {
+ if ( rProp.Value >>= bValue )
+ rElementData.m_bNoClose = bValue;
+ }
}
+ }
- // oversteer values with global settings
- if (bGetSettingsState || bGlobalSettings)
+ // oversteer values with global settings
+ if (bGetSettingsState || bGlobalSettings)
+ {
+ if ( pGlobalSettings->HasToolbarStatesInfo())
{
- if ( pGlobalSettings->HasToolbarStatesInfo())
{
- {
- SolarMutexGuard aWriteLock2;
- bInGlobalSettings = true;
- }
+ SolarMutexGuard aWriteLock2;
+ bInGlobalSettings = true;
+ }
- uno::Any aValue;
- if ( pGlobalSettings->GetToolbarStateInfo(
- GlobalSettings::STATEINFO_LOCKED,
- aValue ))
- aValue >>= rElementData.m_aDockedData.m_bLocked;
- if ( pGlobalSettings->GetToolbarStateInfo(
- GlobalSettings::STATEINFO_DOCKED,
- aValue ))
- {
- bool bValue;
- if ( aValue >>= bValue )
- rElementData.m_bFloating = !bValue;
- }
+ uno::Any aValue;
+ if ( pGlobalSettings->GetToolbarStateInfo(
+ GlobalSettings::STATEINFO_LOCKED,
+ aValue ))
+ aValue >>= rElementData.m_aDockedData.m_bLocked;
+ if ( pGlobalSettings->GetToolbarStateInfo(
+ GlobalSettings::STATEINFO_DOCKED,
+ aValue ))
+ {
+ bool bValue;
+ if ( aValue >>= bValue )
+ rElementData.m_bFloating = !bValue;
}
}
+ }
- const bool bDockingSupportCrippled = !StyleSettings::GetDockingFloatsSupported();
- if (bDockingSupportCrippled)
- rElementData.m_bFloating = false;
+ const bool bDockingSupportCrippled = !StyleSettings::GetDockingFloatsSupported();
+ if (bDockingSupportCrippled)
+ rElementData.m_bFloating = false;
- return true;
- }
- catch (const NoSuchElementException&)
- {
- }
+ return true;
+ }
+ catch (const NoSuchElementException&)
+ {
}
return false;
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;
}
diff --git a/framework/source/services/urltransformer.cxx b/framework/source/services/urltransformer.cxx
index a7655ef9b029..ef9a5d55f152 100644
--- a/framework/source/services/urltransformer.cxx
+++ b/framework/source/services/urltransformer.cxx
@@ -117,41 +117,41 @@ sal_Bool SAL_CALL URLTransformer::parseStrict( css::util::URL& aURL )
}
// Try to extract the protocol
sal_Int32 nURLIndex = aURL.Complete.indexOf( ':' );
- if ( nURLIndex > 1 )
+ if ( nURLIndex <= 1 )
+ return false;
+
+ OUString aProtocol = aURL.Complete.copy( 0, nURLIndex+1 );
+
+ // If INetURLObject knows this protocol let it parse
+ if ( INetURLObject::CompareProtocolScheme( aProtocol ) != INetProtocol::NotValid )
{
- OUString aProtocol = aURL.Complete.copy( 0, nURLIndex+1 );
+ // Initialize parser with given URL.
+ INetURLObject aParser( aURL.Complete );
- // If INetURLObject knows this protocol let it parse
- if ( INetURLObject::CompareProtocolScheme( aProtocol ) != INetProtocol::NotValid )
+ // Get all information about this URL.
+ INetProtocol eINetProt = aParser.GetProtocol();
+ if ( eINetProt == INetProtocol::NotValid )
{
- // Initialize parser with given URL.
- INetURLObject aParser( aURL.Complete );
-
- // Get all information about this URL.
- INetProtocol eINetProt = aParser.GetProtocol();
- if ( eINetProt == INetProtocol::NotValid )
- {
- return false;
- }
- else if ( !aParser.HasError() )
- {
- lcl_ParserHelper(aParser,aURL,false);
- // Return "URL is parsed".
- return true;
- }
+ return false;
}
- else
+ else if ( !aParser.HasError() )
{
- // Minimal support for unknown protocols. This is mandatory to support the "Protocol Handlers" implemented
- // in framework!
- aURL.Protocol = aProtocol;
- aURL.Main = aURL.Complete;
- aURL.Path = aURL.Complete.copy( nURLIndex+1 );
-
+ lcl_ParserHelper(aParser,aURL,false);
// Return "URL is parsed".
return true;
}
}
+ else
+ {
+ // Minimal support for unknown protocols. This is mandatory to support the "Protocol Handlers" implemented
+ // in framework!
+ aURL.Protocol = aProtocol;
+ aURL.Main = aURL.Complete;
+ aURL.Path = aURL.Complete.copy( nURLIndex+1 );
+
+ // Return "URL is parsed".
+ return true;
+ }
return false;
}
diff --git a/framework/source/uiconfiguration/globalsettings.cxx b/framework/source/uiconfiguration/globalsettings.cxx
index 2c517205e2db..b0b6f859c02c 100644
--- a/framework/source/uiconfiguration/globalsettings.cxx
+++ b/framework/source/uiconfiguration/globalsettings.cxx
@@ -160,30 +160,30 @@ bool GlobalSettings_Access::GetToolbarStateInfo( GlobalSettings::StateInfo eStat
impl_initConfigAccess();
}
- if ( m_xConfigAccess.is() )
+ if ( !m_xConfigAccess.is() )
+ return false;
+
+ try
{
- try
- {
- css::uno::Any a = m_xConfigAccess->getByName( m_aNodeRefStates );
- css::uno::Reference< css::container::XNameAccess > xNameAccess;
- if ( a >>= xNameAccess )
- {
- if ( eStateInfo == GlobalSettings::STATEINFO_LOCKED )
- a = xNameAccess->getByName( m_aPropLocked );
- else if ( eStateInfo == GlobalSettings::STATEINFO_DOCKED )
- a = xNameAccess->getByName( m_aPropDocked );
-
- aValue = a;
- return true;
- }
- }
- catch ( const css::container::NoSuchElementException& )
- {
- }
- catch ( const css::uno::Exception& )
+ css::uno::Any a = m_xConfigAccess->getByName( m_aNodeRefStates );
+ css::uno::Reference< css::container::XNameAccess > xNameAccess;
+ if ( a >>= xNameAccess )
{
+ if ( eStateInfo == GlobalSettings::STATEINFO_LOCKED )
+ a = xNameAccess->getByName( m_aPropLocked );
+ else if ( eStateInfo == GlobalSettings::STATEINFO_DOCKED )
+ a = xNameAccess->getByName( m_aPropDocked );
+
+ aValue = a;
+ return true;
}
}
+ catch ( const css::container::NoSuchElementException& )
+ {
+ }
+ catch ( const css::uno::Exception& )
+ {
+ }
return false;
}
diff --git a/framework/source/uiconfiguration/imagemanagerimpl.cxx b/framework/source/uiconfiguration/imagemanagerimpl.cxx
index a847ee35ff68..1dd41fd38bdf 100644
--- a/framework/source/uiconfiguration/imagemanagerimpl.cxx
+++ b/framework/source/uiconfiguration/imagemanagerimpl.cxx
@@ -367,89 +367,89 @@ bool ImageManagerImpl::implts_storeUserImages(
{
SolarMutexGuard g;
- if ( m_bModified )
+ if ( !m_bModified )
+ return false;
+
+ ImageList* pImageList = implts_getUserImageList( nImageType );
+ if ( pImageList->GetImageCount() > 0 )
{
- ImageList* pImageList = implts_getUserImageList( nImageType );
- if ( pImageList->GetImageCount() > 0 )
- {
- ImageItemDescriptorList aUserImageListInfo;
+ ImageItemDescriptorList aUserImageListInfo;
- for ( sal_uInt16 i=0; i < pImageList->GetImageCount(); i++ )
- {
- ImageItemDescriptor aItem;
- aItem.aCommandURL = pImageList->GetImageName( i );
- aUserImageListInfo.push_back( aItem );
- }
+ for ( sal_uInt16 i=0; i < pImageList->GetImageCount(); i++ )
+ {
+ ImageItemDescriptor aItem;
+ aItem.aCommandURL = pImageList->GetImageName( i );
+ aUserImageListInfo.push_back( aItem );
+ }
- uno::Reference< XTransactedObject > xTransaction;
- uno::Reference< XOutputStream > xOutputStream;
- uno::Reference< XStream > xStream = xUserImageStorage->openStreamElement( OUString::createFromAscii( IMAGELIST_XML_FILE[nImageType] ),
- ElementModes::WRITE|ElementModes::TRUNCATE );
- if ( xStream.is() )
+ uno::Reference< XTransactedObject > xTransaction;
+ uno::Reference< XOutputStream > xOutputStream;
+ uno::Reference< XStream > xStream = xUserImageStorage->openStreamElement( OUString::createFromAscii( IMAGELIST_XML_FILE[nImageType] ),
+ ElementModes::WRITE|ElementModes::TRUNCATE );
+ if ( xStream.is() )
+ {
+ uno::Reference< XStream > xBitmapStream =
+ xUserBitmapsStorage->openStreamElement( OUString::createFromAscii( BITMAP_FILE_NAMES[nImageType] ),
+ ElementModes::WRITE|ElementModes::TRUNCATE );
+ if ( xBitmapStream.is() )
{
- uno::Reference< XStream > xBitmapStream =
- xUserBitmapsStorage->openStreamElement( OUString::createFromAscii( BITMAP_FILE_NAMES[nImageType] ),
- ElementModes::WRITE|ElementModes::TRUNCATE );
- if ( xBitmapStream.is() )
{
- {
- std::unique_ptr<SvStream> pSvStream(utl::UcbStreamHelper::CreateStream( xBitmapStream ));
- vcl::PNGWriter aPngWriter( pImageList->GetAsHorizontalStrip() );
- aPngWriter.Write( *pSvStream );
- }
-
- // Commit user bitmaps storage
- xTransaction.set( xUserBitmapsStorage, UNO_QUERY );
- if ( xTransaction.is() )
- xTransaction->commit();
+ std::unique_ptr<SvStream> pSvStream(utl::UcbStreamHelper::CreateStream( xBitmapStream ));
+ vcl::PNGWriter aPngWriter( pImageList->GetAsHorizontalStrip() );
+ aPngWriter.Write( *pSvStream );
}
- xOutputStream = xStream->getOutputStream();
- if ( xOutputStream.is() )
- ImagesConfiguration::StoreImages( m_xContext, xOutputStream, aUserImageListInfo );
-
- // Commit user image storage
- xTransaction.set( xUserImageStorage, UNO_QUERY );
+ // Commit user bitmaps storage
+ xTransaction.set( xUserBitmapsStorage, UNO_QUERY );
if ( xTransaction.is() )
xTransaction->commit();
}
- return true;
- }
- else
- {
- // Remove the streams from the storage, if we have no data. We have to catch
- // the NoSuchElementException as it can be possible that there is no stream at all!
- try
- {
- xUserImageStorage->removeElement( OUString::createFromAscii( IMAGELIST_XML_FILE[nImageType] ));
- }
- catch ( const css::container::NoSuchElementException& )
- {
- }
-
- try
- {
- xUserBitmapsStorage->removeElement( OUString::createFromAscii( BITMAP_FILE_NAMES[nImageType] ));
- }
- catch ( const css::container::NoSuchElementException& )
- {
- }
-
- uno::Reference< XTransactedObject > xTransaction;
+ xOutputStream = xStream->getOutputStream();
+ if ( xOutputStream.is() )
+ ImagesConfiguration::StoreImages( m_xContext, xOutputStream, aUserImageListInfo );
// Commit user image storage
xTransaction.set( xUserImageStorage, UNO_QUERY );
if ( xTransaction.is() )
xTransaction->commit();
+ }
- // Commit user bitmaps storage
- xTransaction.set( xUserBitmapsStorage, UNO_QUERY );
- if ( xTransaction.is() )
- xTransaction->commit();
+ return true;
+ }
+ else
+ {
+ // Remove the streams from the storage, if we have no data. We have to catch
+ // the NoSuchElementException as it can be possible that there is no stream at all!
+ try
+ {
+ xUserImageStorage->removeElement( OUString::createFromAscii( IMAGELIST_XML_FILE[nImageType] ));
+ }
+ catch ( const css::container::NoSuchElementException& )
+ {
+ }
- return true;
+ try
+ {
+ xUserBitmapsStorage->removeElement( OUString::createFromAscii( BITMAP_FILE_NAMES[nImageType] ));
}
+ catch ( const css::container::NoSuchElementException& )
+ {
+ }
+
+ uno::Reference< XTransactedObject > xTransaction;
+
+ // Commit user image storage
+ xTransaction.set( xUserImageStorage, UNO_QUERY );
+ if ( xTransaction.is() )
+ xTransaction->commit();
+
+ // Commit user bitmaps storage
+ xTransaction.set( xUserBitmapsStorage, UNO_QUERY );
+ if ( xTransaction.is() )
+ xTransaction->commit();
+
+ return true;
}
return false;
diff --git a/framework/source/uielement/imagebuttontoolbarcontroller.cxx b/framework/source/uielement/imagebuttontoolbarcontroller.cxx
index e03a3cbc156a..350b2190dc84 100644
--- a/framework/source/uielement/imagebuttontoolbarcontroller.cxx
+++ b/framework/source/uielement/imagebuttontoolbarcontroller.cxx
@@ -117,27 +117,27 @@ void ImageButtonToolbarController::executeControlCommand( const css::frame::Cont
bool ImageButtonToolbarController::ReadImageFromURL( bool bBigImage, const OUString& aImageURL, Image& aImage )
{
std::unique_ptr<SvStream> pStream(utl::UcbStreamHelper::CreateStream( aImageURL, StreamMode::STD_READ ));
- if ( pStream && ( pStream->GetErrorCode() == ERRCODE_NONE ))
- {
- // Use graphic class to also support more graphic formats (bmp,png,...)
- Graphic aGraphic;
+ if ( !pStream || ( pStream->GetErrorCode() != ERRCODE_NONE ))
+ return false;
- GraphicFilter& rGF = GraphicFilter::GetGraphicFilter();
- rGF.ImportGraphic( aGraphic, OUString(), *pStream );
+ // Use graphic class to also support more graphic formats (bmp,png,...)
+ Graphic aGraphic;
- BitmapEx aBitmapEx = aGraphic.GetBitmapEx();
+ GraphicFilter& rGF = GraphicFilter::GetGraphicFilter();
+ rGF.ImportGraphic( aGraphic, OUString(), *pStream );
- const ::Size aSize = bBigImage ? aImageSizeBig : aImageSizeSmall; // Sizes used for toolbar images
+ BitmapEx aBitmapEx = aGraphic.GetBitmapEx();
- ::Size aBmpSize = aBitmapEx.GetSizePixel();
- if ( !aBmpSize.IsEmpty() )
- {
- ::Size aNoScaleSize( aBmpSize.Width(), aSize.Height() );
- if ( aBmpSize != aNoScaleSize )
- aBitmapEx.Scale( aNoScaleSize, BmpScaleFlag::BestQuality );
- aImage = Image( aBitmapEx );
- return true;
- }
+ const ::Size aSize = bBigImage ? aImageSizeBig : aImageSizeSmall; // Sizes used for toolbar images
+
+ ::Size aBmpSize = aBitmapEx.GetSizePixel();
+ if ( !aBmpSize.IsEmpty() )
+ {
+ ::Size aNoScaleSize( aBmpSize.Width(), aSize.Height() );
+ if ( aBmpSize != aNoScaleSize )
+ aBitmapEx.Scale( aNoScaleSize, BmpScaleFlag::BestQuality );
+ aImage = Image( aBitmapEx );
+ return true;
}
return false;
diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx
index e17268d8d997..08998a4b8fe8 100644
--- a/framework/source/uielement/menubarmanager.cxx
+++ b/framework/source/uielement/menubarmanager.cxx
@@ -561,179 +561,179 @@ private:
IMPL_LINK( MenuBarManager, Activate, Menu *, pMenu, bool )
{
- if ( pMenu == m_pVCLMenu )
- {
- css::uno::ContextLayer layer(
- new QuietInteractionContext(
- css::uno::getCurrentContext()));
+ if ( pMenu != m_pVCLMenu )
+ return true;
- // set/unset hiding disabled menu entries
- bool bDontHide = officecfg::Office::Common::View::Menu::DontHideDisabledEntry::get();
- const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings();
- bool bShowMenuImages = rSettings.GetUseImagesInMenus();
- bool bShowShortcuts = m_bHasMenuBar || rSettings.GetContextMenuShortcuts();
- bool bHasDisabledEntries = SvtCommandOptions().HasEntries( SvtCommandOptions::CMDOPTION_DISABLED );
+ css::uno::ContextLayer layer(
+ new QuietInteractionContext(
+ css::uno::getCurrentContext()));
- SolarMutexGuard g;
+ // set/unset hiding disabled menu entries
+ bool bDontHide = officecfg::Office::Common::View::Menu::DontHideDisabledEntry::get();
+ const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings();
+ bool bShowMenuImages = rSettings.GetUseImagesInMenus();
+ bool bShowShortcuts = m_bHasMenuBar || rSettings.GetContextMenuShortcuts();
+ bool bHasDisabledEntries = SvtCommandOptions().HasEntries( SvtCommandOptions::CMDOPTION_DISABLED );
- MenuFlags nFlag = pMenu->GetMenuFlags();
- if ( bDontHide )
- nFlag &= ~MenuFlags::HideDisabledEntries;
- else
- nFlag |= MenuFlags::HideDisabledEntries;
- pMenu->SetMenuFlags( nFlag );
+ SolarMutexGuard g;
- if ( m_bActive )
- return false;
+ MenuFlags nFlag = pMenu->GetMenuFlags();
+ if ( bDontHide )
+ nFlag &= ~MenuFlags::HideDisabledEntries;
+ else
+ nFlag |= MenuFlags::HideDisabledEntries;
+ pMenu->SetMenuFlags( nFlag );
- m_bActive = true;
+ if ( m_bActive )
+ return false;
- // Check if some modes have changed so we have to update our menu images
- OUString sIconTheme = SvtMiscOptions().GetIconTheme();
+ m_bActive = true;
- if ( m_bRetrieveImages ||
- bShowMenuImages != m_bShowMenuImages ||
- sIconTheme != m_sIconTheme )
- {
- m_bShowMenuImages = bShowMenuImages;
- m_bRetrieveImages = false;
- m_sIconTheme = sIconTheme;
- FillMenuImages( m_xFrame, pMenu, bShowMenuImages );
- }
+ // Check if some modes have changed so we have to update our menu images
+ OUString sIconTheme = SvtMiscOptions().GetIconTheme();
- // Try to map commands to labels
- for ( sal_uInt16 nPos = 0; nPos < pMenu->GetItemCount(); nPos++ )
+ if ( m_bRetrieveImages ||
+ bShowMenuImages != m_bShowMenuImages ||
+ sIconTheme != m_sIconTheme )
+ {
+ m_bShowMenuImages = bShowMenuImages;
+ m_bRetrieveImages = false;
+ m_sIconTheme = sIconTheme;
+ FillMenuImages( m_xFrame, pMenu, bShowMenuImages );
+ }
+
+ // Try to map commands to labels
+ for ( sal_uInt16 nPos = 0; nPos < pMenu->GetItemCount(); nPos++ )
+ {
+ sal_uInt16 nItemId = pMenu->GetItemId( nPos );
+ if (( pMenu->GetItemType( nPos ) != MenuItemType::SEPARATOR ) &&
+ ( pMenu->GetItemText( nItemId ).isEmpty() ))
{
- sal_uInt16 nItemId = pMenu->GetItemId( nPos );
- if (( pMenu->GetItemType( nPos ) != MenuItemType::SEPARATOR ) &&
- ( pMenu->GetItemText( nItemId ).isEmpty() ))
- {
- OUString aCommand = pMenu->GetItemCommand( nItemId );
- if ( !aCommand.isEmpty() ) {
- pMenu->SetItemText( nItemId, RetrieveLabelFromCommand( aCommand ));
- }
+ OUString aCommand = pMenu->GetItemCommand( nItemId );
+ if ( !aCommand.isEmpty() ) {
+ pMenu->SetItemText( nItemId, RetrieveLabelFromCommand( aCommand ));
}
}
+ }
- // Try to set accelerator keys
- {
- if ( bShowShortcuts )
- RetrieveShortcuts( m_aMenuItemHandlerVector );
+ // Try to set accelerator keys
+ {
+ if ( bShowShortcuts )
+ RetrieveShortcuts( m_aMenuItemHandlerVector );
- for (auto const& menuItemHandler : m_aMenuItemHandlerVector)
+ for (auto const& menuItemHandler : m_aMenuItemHandlerVector)
+ {
+ if ( !bShowShortcuts )
{
- if ( !bShowShortcuts )
- {
- pMenu->SetAccelKey( menuItemHandler->nItemId, vcl::KeyCode() );
- }
- else if ( menuItemHandler->aMenuItemURL == aCmdHelpIndex )
- {
- // Set key code, workaround for hard-coded shortcut F1 mapped to .uno:HelpIndex
- // Only non-popup menu items can have a short-cut
- vcl::KeyCode aKeyCode( KEY_F1 );
- pMenu->SetAccelKey( menuItemHandler->nItemId, aKeyCode );
- }
- else if ( pMenu->GetPopupMenu( menuItemHandler->nItemId ) == nullptr )
- pMenu->SetAccelKey( menuItemHandler->nItemId, menuItemHandler->aKeyCode );
+ pMenu->SetAccelKey( menuItemHandler->nItemId, vcl::KeyCode() );
}
+ else if ( menuItemHandler->aMenuItemURL == aCmdHelpIndex )
+ {
+ // Set key code, workaround for hard-coded shortcut F1 mapped to .uno:HelpIndex
+ // Only non-popup menu items can have a short-cut
+ vcl::KeyCode aKeyCode( KEY_F1 );
+ pMenu->SetAccelKey( menuItemHandler->nItemId, aKeyCode );
+ }
+ else if ( pMenu->GetPopupMenu( menuItemHandler->nItemId ) == nullptr )
+ pMenu->SetAccelKey( menuItemHandler->nItemId, menuItemHandler->aKeyCode );
}
+ }
- URL aTargetURL;
+ URL aTargetURL;
- // Use provided dispatch provider => fallback to frame as dispatch provider
- Reference< XDispatchProvider > xDispatchProvider;
- if ( m_xDispatchProvider.is() )
- xDispatchProvider = m_xDispatchProvider;
- else
- xDispatchProvider.set( m_xFrame, UNO_QUERY );
+ // Use provided dispatch provider => fallback to frame as dispatch provider
+ Reference< XDispatchProvider > xDispatchProvider;
+ if ( m_xDispatchProvider.is() )
+ xDispatchProvider = m_xDispatchProvider;
+ else
+ xDispatchProvider.set( m_xFrame, UNO_QUERY );
- if ( xDispatchProvider.is() )
+ if ( !xDispatchProvider.is() )
+ return true;
+
+ SvtCommandOptions aCmdOptions;
+ for (auto const& menuItemHandler : m_aMenuItemHandlerVector)
+ {
+ if (menuItemHandler)
{
- SvtCommandOptions aCmdOptions;
- for (auto const& menuItemHandler : m_aMenuItemHandlerVector)
+ if ( !menuItemHandler->xMenuItemDispatch.is() &&
+ !menuItemHandler->xSubMenuManager.is() )
{
- if (menuItemHandler)
- {
- if ( !menuItemHandler->xMenuItemDispatch.is() &&
- !menuItemHandler->xSubMenuManager.is() )
- {
- Reference< XDispatch > xMenuItemDispatch;
+ Reference< XDispatch > xMenuItemDispatch;
- aTargetURL.Complete = menuItemHandler->aMenuItemURL;
+ aTargetURL.Complete = menuItemHandler->aMenuItemURL;
- m_xURLTransformer->parseStrict( aTargetURL );
+ m_xURLTransformer->parseStrict( aTargetURL );
- if ( bHasDisabledEntries )
- {
- if ( aCmdOptions.Lookup( SvtCommandOptions::CMDOPTION_DISABLED, aTargetURL.Path ))
- pMenu->HideItem( menuItemHandler->nItemId );
- }
+ if ( bHasDisabledEntries )
+ {
+ if ( aCmdOptions.Lookup( SvtCommandOptions::CMDOPTION_DISABLED, aTargetURL.Path ))
+ pMenu->HideItem( menuItemHandler->nItemId );
+ }
- if ( aTargetURL.Complete.startsWith( ".uno:StyleApply?" ) )
- xMenuItemDispatch = new StyleDispatcher( m_xFrame, m_xURLTransformer, aTargetURL );
- else
- xMenuItemDispatch = xDispatchProvider->queryDispatch( aTargetURL, menuItemHandler->aTargetFrame, 0 );
+ if ( aTargetURL.Complete.startsWith( ".uno:StyleApply?" ) )
+ xMenuItemDispatch = new StyleDispatcher( m_xFrame, m_xURLTransformer, aTargetURL );
+ else
+ xMenuItemDispatch = xDispatchProvider->queryDispatch( aTargetURL, menuItemHandler->aTargetFrame, 0 );
- bool bPopupMenu( false );
- if ( !menuItemHandler->xPopupMenuController.is() &&
- m_xPopupMenuControllerFactory->hasController( menuItemHandler->aMenuItemURL, m_aModuleIdentifier ) )
- {
- if( xMenuItemDispatch.is() || menuItemHandler->aMenuItemURL != ".uno:RecentFileList" )
- bPopupMenu = CreatePopupMenuController(menuItemHandler.get(), m_xDispatchProvider, m_aModuleIdentifier);
- }
- else if ( menuItemHandler->xPopupMenuController.is() )
- {
- // Force update of popup menu
- menuItemHandler->xPopupMenuController->updatePopupMenu();
- bPopupMenu = true;
- if (PopupMenu* pThisPopup = pMenu->GetPopupMenu( menuItemHandler->nItemId ))
- pMenu->EnableItem( menuItemHandler->nItemId, pThisPopup->GetItemCount() != 0 );
- }
- lcl_CheckForChildren(pMenu, menuItemHandler->nItemId);
+ bool bPopupMenu( false );
+ if ( !menuItemHandler->xPopupMenuController.is() &&
+ m_xPopupMenuControllerFactory->hasController( menuItemHandler->aMenuItemURL, m_aModuleIdentifier ) )
+ {
+ if( xMenuItemDispatch.is() || menuItemHandler->aMenuItemURL != ".uno:RecentFileList" )
+ bPopupMenu = CreatePopupMenuController(menuItemHandler.get(), m_xDispatchProvider, m_aModuleIdentifier);
+ }
+ else if ( menuItemHandler->xPopupMenuController.is() )
+ {
+ // Force update of popup menu
+ menuItemHandler->xPopupMenuController->updatePopupMenu();
+ bPopupMenu = true;
+ if (PopupMenu* pThisPopup = pMenu->GetPopupMenu( menuItemHandler->nItemId ))
+ pMenu->EnableItem( menuItemHandler->nItemId, pThisPopup->GetItemCount() != 0 );
+ }
+ lcl_CheckForChildren(pMenu, menuItemHandler->nItemId);
- if ( xMenuItemDispatch.is() )
- {
- menuItemHandler->xMenuItemDispatch = xMenuItemDispatch;
- menuItemHandler->aParsedItemURL = aTargetURL.Complete;
-
- if ( !bPopupMenu )
- {
- xMenuItemDispatch->addStatusListener( static_cast< XStatusListener* >( this ), aTargetURL );
- // For the menubar, we have to keep status listening to support Ubuntu's HUD.
- if ( !m_bHasMenuBar )
- xMenuItemDispatch->removeStatusListener( static_cast< XStatusListener* >( this ), aTargetURL );
- }
- }
- else if ( !bPopupMenu )
- pMenu->EnableItem( menuItemHandler->nItemId, false );
- }
- else if ( menuItemHandler->xPopupMenuController.is() )
+ if ( xMenuItemDispatch.is() )
+ {
+ menuItemHandler->xMenuItemDispatch = xMenuItemDispatch;
+ menuItemHandler->aParsedItemURL = aTargetURL.Complete;
+
+ if ( !bPopupMenu )
{
- // Force update of popup menu
- menuItemHandler->xPopupMenuController->updatePopupMenu();
- lcl_CheckForChildren(pMenu, menuItemHandler->nItemId);
+ xMenuItemDispatch->addStatusListener( static_cast< XStatusListener* >( this ), aTargetURL );
+ // For the menubar, we have to keep status listening to support Ubuntu's HUD.
+ if ( !m_bHasMenuBar )
+ xMenuItemDispatch->removeStatusListener( static_cast< XStatusListener* >( this ), aTargetURL );
}
- else if ( menuItemHandler->xMenuItemDispatch.is() )
- {
- // We need an update to reflect the current state
- try
- {
- aTargetURL.Complete = menuItemHandler->aMenuItemURL;
- m_xURLTransformer->parseStrict( aTargetURL );
+ }
+ else if ( !bPopupMenu )
+ pMenu->EnableItem( menuItemHandler->nItemId, false );
+ }
+ else if ( menuItemHandler->xPopupMenuController.is() )
+ {
+ // Force update of popup menu
+ menuItemHandler->xPopupMenuController->updatePopupMenu();
+ lcl_CheckForChildren(pMenu, menuItemHandler->nItemId);
+ }
+ else if ( menuItemHandler->xMenuItemDispatch.is() )
+ {
+ // We need an update to reflect the current state
+ try
+ {
+ aTargetURL.Complete = menuItemHandler->aMenuItemURL;
+ m_xURLTransformer->parseStrict( aTargetURL );
- menuItemHandler->xMenuItemDispatch->addStatusListener(
- static_cast< XStatusListener* >( this ), aTargetURL );
- menuItemHandler->xMenuItemDispatch->removeStatusListener(
- static_cast< XStatusListener* >( this ), aTargetURL );
- }
- catch ( const Exception& )
- {
- }
- }
- else if ( menuItemHandler->xSubMenuManager.is() )
- lcl_CheckForChildren(pMenu, menuItemHandler->nItemId);
+ menuItemHandler->xMenuItemDispatch->addStatusListener(
+ static_cast< XStatusListener* >( this ), aTargetURL );
+ menuItemHandler->xMenuItemDispatch->removeStatusListener(
+ static_cast< XStatusListener* >( this ), aTargetURL );
+ }
+ catch ( const Exception& )
+ {
}
}
+ else if ( menuItemHandler->xSubMenuManager.is() )
+ lcl_CheckForChildren(pMenu, menuItemHandler->nItemId);
}
}
@@ -822,45 +822,43 @@ IMPL_LINK( MenuBarManager, Select, Menu *, pMenu, bool )
bool MenuBarManager::MustBeHidden( PopupMenu* pPopupMenu, const Reference< XURLTransformer >& rTransformer )
{
- if ( pPopupMenu )
- {
- URL aTargetURL;
- SvtCommandOptions aCmdOptions;
+ if ( !pPopupMenu )
+ return true;
+
+ URL aTargetURL;
+ SvtCommandOptions aCmdOptions;
- sal_uInt16 nCount = pPopupMenu->GetItemCount();
- sal_uInt16 nHideCount( 0 );
+ sal_uInt16 nCount = pPopupMenu->GetItemCount();
+ sal_uInt16 nHideCount( 0 );
- for ( sal_uInt16 i = 0; i < nCount; i++ )
+ for ( sal_uInt16 i = 0; i < nCount; i++ )
+ {
+ sal_uInt16 nId = pPopupMenu->GetItemId( i );
+ if ( nId > 0 )
{
- sal_uInt16 nId = pPopupMenu->GetItemId( i );
- if ( nId > 0 )
+ PopupMenu* pSubPopupMenu = pPopupMenu->GetPopupMenu( nId );
+ if ( pSubPopupMenu )
{
- PopupMenu* pSubPopupMenu = pPopupMenu->GetPopupMenu( nId );
- if ( pSubPopupMenu )
- {
- if ( MustBeHidden( pSubPopupMenu, rTransformer ))
- {
- pPopupMenu->HideItem( nId );
- ++nHideCount;
- }
- }
- else
+ if ( MustBeHidden( pSubPopupMenu, rTransformer ))
{
- aTargetURL.Complete = pPopupMenu->GetItemCommand( nId );
- rTransformer->parseStrict( aTargetURL );
-
- if ( aCmdOptions.Lookup( SvtCommandOptions::CMDOPTION_DISABLED, aTargetURL.Path ))
- ++nHideCount;
+ pPopupMenu->HideItem( nId );
+ ++nHideCount;
}
}
else
- ++nHideCount;
- }
+ {
+ aTargetURL.Complete = pPopupMenu->GetItemCommand( nId );
+ rTransformer->parseStrict( aTargetURL );
- return ( nCount == nHideCount );
+ if ( aCmdOptions.Lookup( SvtCommandOptions::CMDOPTION_DISABLED, aTargetURL.Path ))
+ ++nHideCount;
+ }
+ }
+ else
+ ++nHideCount;
}
- return true;
+ return ( nCount == nHideCount );
}
OUString MenuBarManager::RetrieveLabelFromCommand(const OUString& rCmdURL)
diff --git a/framework/source/uifactory/factoryconfiguration.cxx b/framework/source/uifactory/factoryconfiguration.cxx
index d27cdb145dbd..a5fe31a7557b 100644
--- a/framework/source/uifactory/factoryconfiguration.cxx
+++ b/framework/source/uifactory/factoryconfiguration.cxx
@@ -262,23 +262,23 @@ bool ConfigurationAccess_ControllerFactory::impl_getElementProps( const Any& aEl
Reference< XPropertySet > xPropertySet;
aElement >>= xPropertySet;
- if ( xPropertySet.is() )
+ if ( !xPropertySet.is() )
+ return true;
+
+ try
{
- try
- {
- xPropertySet->getPropertyValue( m_aPropCommand ) >>= aCommand;
- xPropertySet->getPropertyValue( m_aPropModule ) >>= aModule;
- xPropertySet->getPropertyValue( m_aPropController ) >>= aServiceSpecifier;
- xPropertySet->getPropertyValue( m_aPropValue ) >>= aValue;
- }
- catch ( const css::beans::UnknownPropertyException& )
- {
- return false;
- }
- catch ( const css::lang::WrappedTargetException& )
- {
- return false;
- }
+ xPropertySet->getPropertyValue( m_aPropCommand ) >>= aCommand;
+ xPropertySet->getPropertyValue( m_aPropModule ) >>= aModule;
+ xPropertySet->getPropertyValue( m_aPropController ) >>= aServiceSpecifier;
+ xPropertySet->getPropertyValue( m_aPropValue ) >>= aValue;
+ }
+ catch ( const css::beans::UnknownPropertyException& )
+ {
+ return false;
+ }
+ catch ( const css::lang::WrappedTargetException& )
+ {
+ return false;
}
return true;
diff --git a/framework/source/uifactory/uielementfactorymanager.cxx b/framework/source/uifactory/uielementfactorymanager.cxx
index a8c40552609f..918fef603451 100644
--- a/framework/source/uifactory/uielementfactorymanager.cxx
+++ b/framework/source/uifactory/uielementfactorymanager.cxx
@@ -315,23 +315,23 @@ bool ConfigurationAccess_FactoryManager::impl_getElementProps( const Any& aEleme
Reference< XPropertySet > xPropertySet;
aElement >>= xPropertySet;
- if ( xPropertySet.is() )
+ if ( !xPropertySet.is() )
+ return true;
+
+ try
{
- try
- {
- xPropertySet->getPropertyValue( m_aPropType ) >>= rType;
- xPropertySet->getPropertyValue( m_aPropName ) >>= rName;
- xPropertySet->getPropertyValue( m_aPropModule ) >>= rModule;
- xPropertySet->getPropertyValue( m_aPropFactory ) >>= rServiceSpecifier;
- }
- catch ( const css::beans::UnknownPropertyException& )
- {
- return false;
- }
- catch ( const css::lang::WrappedTargetException& )
- {
- return false;
- }
+ xPropertySet->getPropertyValue( m_aPropType ) >>= rType;
+ xPropertySet->getPropertyValue( m_aPropName ) >>= rName;
+ xPropertySet->getPropertyValue( m_aPropModule ) >>= rModule;
+ xPropertySet->getPropertyValue( m_aPropFactory ) >>= rServiceSpecifier;
+ }
+ catch ( const css::beans::UnknownPropertyException& )
+ {
+ return false;
+ }
+ catch ( const css::lang::WrappedTargetException& )
+ {
+ return false;
}
return true;