summaryrefslogtreecommitdiff
path: root/framework/source/uielement/toolbarmanager.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-04-07 20:32:26 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-04-08 11:01:31 +0200
commitff25a4a6f4b9763b09abbbd6a711fa4d18f40ade (patch)
treeded29238e8fb782c20b429f6d5df6c40a3bb2604 /framework/source/uielement/toolbarmanager.cxx
parent32343bcbb786168df62f85a57e30c620c3d3bdb4 (diff)
loplugin:flatten in framework
Change-Id: I2a74a7543b5edd853396efa31a3e2568e6607778 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91848 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'framework/source/uielement/toolbarmanager.cxx')
-rw-r--r--framework/source/uielement/toolbarmanager.cxx148
1 files changed, 74 insertions, 74 deletions
diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx
index d224cfc2a955..9aa20b7933e5 100644
--- a/framework/source/uielement/toolbarmanager.cxx
+++ b/framework/source/uielement/toolbarmanager.cxx
@@ -563,48 +563,48 @@ void ToolBarManager::impl_elementChanged(bool const isRemove,
sal_Int16 nImageType = sal_Int16();
sal_Int16 nCurrentImageType = getCurrentImageType();
- if (( Event.aInfo >>= nImageType ) &&
+ if (!(( Event.aInfo >>= nImageType ) &&
( nImageType == nCurrentImageType ) &&
- ( Event.Element >>= xNameAccess ))
- {
- sal_Int16 nImageInfo( 1 );
- Reference< XInterface > xIfacDocImgMgr( m_xDocImageManager, UNO_QUERY );
- if ( xIfacDocImgMgr == Event.Source )
- nImageInfo = 0;
+ ( Event.Element >>= xNameAccess )))
+ return;
- Sequence< OUString > aSeq = xNameAccess->getElementNames();
- for ( sal_Int32 i = 0; i < aSeq.getLength(); i++ )
+ sal_Int16 nImageInfo( 1 );
+ Reference< XInterface > xIfacDocImgMgr( m_xDocImageManager, UNO_QUERY );
+ if ( xIfacDocImgMgr == Event.Source )
+ nImageInfo = 0;
+
+ Sequence< OUString > aSeq = xNameAccess->getElementNames();
+ for ( sal_Int32 i = 0; i < aSeq.getLength(); i++ )
+ {
+ CommandToInfoMap::iterator pIter = m_aCommandMap.find( aSeq[i] );
+ if ( pIter != m_aCommandMap.end() && ( pIter->second.nImageInfo >= nImageInfo ))
{
- CommandToInfoMap::iterator pIter = m_aCommandMap.find( aSeq[i] );
- if ( pIter != m_aCommandMap.end() && ( pIter->second.nImageInfo >= nImageInfo ))
+ if (isRemove)
{
- if (isRemove)
+ Image aImage;
+ if (( pIter->second.nImageInfo == 0 ) && ( pIter->second.nImageInfo == nImageInfo ))
{
- Image aImage;
- if (( pIter->second.nImageInfo == 0 ) && ( pIter->second.nImageInfo == nImageInfo ))
- {
- // Special case: An image from the document image manager has been removed.
- // It is possible that we have an image at our module image manager. Before
- // we can remove our image we have to ask our module image manager.
- Sequence< OUString > aCmdURLSeq( 1 );
- Sequence< Reference< XGraphic > > aGraphicSeq;
- aCmdURLSeq[0] = pIter->first;
- aGraphicSeq = m_xModuleImageManager->getImages( nImageType, aCmdURLSeq );
- aImage = Image( aGraphicSeq[0] );
- }
+ // Special case: An image from the document image manager has been removed.
+ // It is possible that we have an image at our module image manager. Before
+ // we can remove our image we have to ask our module image manager.
+ Sequence< OUString > aCmdURLSeq( 1 );
+ Sequence< Reference< XGraphic > > aGraphicSeq;
+ aCmdURLSeq[0] = pIter->first;
+ aGraphicSeq = m_xModuleImageManager->getImages( nImageType, aCmdURLSeq );
+ aImage = Image( aGraphicSeq[0] );
+ }
- setToolBarImage(aImage,pIter);
- } // if (isRemove)
- else
+ setToolBarImage(aImage,pIter);
+ } // if (isRemove)
+ else
+ {
+ Reference< XGraphic > xGraphic;
+ if ( xNameAccess->getByName( aSeq[i] ) >>= xGraphic )
{
- Reference< XGraphic > xGraphic;
- if ( xNameAccess->getByName( aSeq[i] ) >>= xGraphic )
- {
- Image aImage( xGraphic );
- setToolBarImage(aImage,pIter);
- }
- pIter->second.nImageInfo = nImageInfo;
+ Image aImage( xGraphic );
+ setToolBarImage(aImage,pIter);
}
+ pIter->second.nImageInfo = nImageInfo;
}
}
}
@@ -1155,18 +1155,18 @@ void ToolBarManager::FillToolbar( const Reference< XIndexAccess >& rItemContaine
// Try to retrieve UIName from the container property set and set it as the title
// if it is not empty.
Reference< XPropertySet > xPropSet( rItemContainer, UNO_QUERY );
- if ( xPropSet.is() )
+ if ( !xPropSet.is() )
+ return;
+
+ try
+ {
+ OUString aUIName;
+ xPropSet->getPropertyValue("UIName") >>= aUIName;
+ if ( !aUIName.isEmpty() )
+ m_pToolBar->SetText( aUIName );
+ }
+ catch (const Exception&)
{
- try
- {
- OUString aUIName;
- xPropSet->getPropertyValue("UIName") >>= aUIName;
- if ( !aUIName.isEmpty() )
- m_pToolBar->SetText( aUIName );
- }
- catch (const Exception&)
- {
- }
}
}
@@ -1280,37 +1280,37 @@ void ToolBarManager::RequestImages()
void ToolBarManager::notifyRegisteredControllers( const OUString& aUIElementName, const OUString& aCommand )
{
SolarMutexClearableGuard aGuard;
- if ( !m_aSubToolBarControllerMap.empty() )
- {
- SubToolBarToSubToolBarControllerMap::const_iterator pIter =
- m_aSubToolBarControllerMap.find( aUIElementName );
+ if ( m_aSubToolBarControllerMap.empty() )
+ return;
- if ( pIter != m_aSubToolBarControllerMap.end() )
- {
- const SubToolBarControllerVector& rSubToolBarVector = pIter->second;
- if ( !rSubToolBarVector.empty() )
- {
- SubToolBarControllerVector aNotifyVector = rSubToolBarVector;
- aGuard.clear();
+ SubToolBarToSubToolBarControllerMap::const_iterator pIter =
+ m_aSubToolBarControllerMap.find( aUIElementName );
- const sal_uInt32 nCount = aNotifyVector.size();
- for ( sal_uInt32 i=0; i < nCount; i++ )
- {
- try
- {
- Reference< XSubToolbarController > xController = aNotifyVector[i];
- if ( xController.is() )
- xController->functionSelected( aCommand );
- }
- catch (const RuntimeException&)
- {
- throw;
- }
- catch (const Exception&)
- {
- }
- }
- }
+ if ( pIter == m_aSubToolBarControllerMap.end() )
+ return;
+
+ const SubToolBarControllerVector& rSubToolBarVector = pIter->second;
+ if ( rSubToolBarVector.empty() )
+ return;
+
+ SubToolBarControllerVector aNotifyVector = rSubToolBarVector;
+ aGuard.clear();
+
+ const sal_uInt32 nCount = aNotifyVector.size();
+ for ( sal_uInt32 i=0; i < nCount; i++ )
+ {
+ try
+ {
+ Reference< XSubToolbarController > xController = aNotifyVector[i];
+ if ( xController.is() )
+ xController->functionSelected( aCommand );
+ }
+ catch (const RuntimeException&)
+ {
+ throw;
+ }
+ catch (const Exception&)
+ {
}
}
}