framework/source/classes/menumanager.cxx | 3 +- framework/source/fwe/classes/bmkmenu.cxx | 3 +- framework/source/fwe/xml/menudocumenthandler.cxx | 3 -- framework/source/fwe/xml/statusbardocumenthandler.cxx | 3 -- framework/source/fwe/xml/toolboxdocumenthandler.cxx | 3 -- framework/source/layoutmanager/toolbarlayoutmanager.cxx | 17 ++++++---------- framework/source/uielement/menubarmanager.cxx | 5 ++-- framework/source/uielement/toolbarmanager.cxx | 2 - framework/source/uielement/toolbarsmenucontroller.cxx | 3 +- 9 files changed, 20 insertions(+), 22 deletions(-)
New commits: commit 38b8c1e8804c8556e71e1ec7c1f1350d75dc04bf Author: Michael Weghorn <m.wegh...@posteo.de> Date: Tue Dec 16 18:04:05 2014 +0100 fdo#39440 reduce scope of local variables This addresses some cppcheck warnings. Change-Id: I57f336c6ab3c418eac82397edeadecb4c1b168a7 Reviewed-on: https://gerrit.libreoffice.org/13495 Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/framework/source/classes/menumanager.cxx b/framework/source/classes/menumanager.cxx index 0abb093..c09cc87 100644 --- a/framework/source/classes/menumanager.cxx +++ b/framework/source/classes/menumanager.cxx @@ -507,11 +507,12 @@ void MenuManager::UpdateSpecialFileMenu( Menu* pMenu ) { SolarMutexGuard g; - int nRemoveItemCount = 0; int nItemCount = pMenu->GetItemCount(); if ( nItemCount > 0 ) { + int nRemoveItemCount = 0; + // remove all old picklist entries from menu sal_uInt16 nPos = pMenu->GetItemPos( START_ITEMID_PICKLIST ); for ( sal_uInt16 n = nPos; n < pMenu->GetItemCount(); ) diff --git a/framework/source/fwe/classes/bmkmenu.cxx b/framework/source/fwe/classes/bmkmenu.cxx index 550da2a..bf1396b 100644 --- a/framework/source/fwe/classes/bmkmenu.cxx +++ b/framework/source/fwe/classes/bmkmenu.cxx @@ -136,11 +136,12 @@ void BmkMenu::Initialize() InsertSeparator(); else { - bool bImageSet = false; sal_uInt16 nId = CreateMenuId(); if ( bShowMenuImages ) { + bool bImageSet = false; + if ( !aImageId.isEmpty() ) { Image aImage = GetImageFromURL( m_xFrame, aImageId, false ); diff --git a/framework/source/fwe/xml/menudocumenthandler.cxx b/framework/source/fwe/xml/menudocumenthandler.cxx index 3d8945d..58e0389 100644 --- a/framework/source/fwe/xml/menudocumenthandler.cxx +++ b/framework/source/fwe/xml/menudocumenthandler.cxx @@ -184,10 +184,9 @@ throw( SAXException, RuntimeException, std::exception ) OUString ReadMenuDocumentHandlerBase::getErrorLineString() { - char buffer[32]; - if ( m_xLocator.is() ) { + char buffer[32]; snprintf( buffer, sizeof(buffer), "Line: %ld - ", static_cast<long>( m_xLocator->getLineNumber() )); return OUString::createFromAscii( buffer ); } diff --git a/framework/source/fwe/xml/statusbardocumenthandler.cxx b/framework/source/fwe/xml/statusbardocumenthandler.cxx index a3bd46b..ddc360c 100644 --- a/framework/source/fwe/xml/statusbardocumenthandler.cxx +++ b/framework/source/fwe/xml/statusbardocumenthandler.cxx @@ -469,10 +469,9 @@ OUString OReadStatusBarDocumentHandler::getErrorLineString() { SolarMutexGuard g; - char buffer[32]; - if ( m_xLocator.is() ) { + char buffer[32]; snprintf( buffer, sizeof(buffer), "Line: %ld - ", static_cast<long>( m_xLocator->getLineNumber() )); return OUString::createFromAscii( buffer ); } diff --git a/framework/source/fwe/xml/toolboxdocumenthandler.cxx b/framework/source/fwe/xml/toolboxdocumenthandler.cxx index e6065a1..15c0ad3 100644 --- a/framework/source/fwe/xml/toolboxdocumenthandler.cxx +++ b/framework/source/fwe/xml/toolboxdocumenthandler.cxx @@ -639,10 +639,9 @@ OUString OReadToolBoxDocumentHandler::getErrorLineString() { SolarMutexGuard g; - char buffer[32]; - if ( m_xLocator.is() ) { + char buffer[32]; snprintf( buffer, sizeof(buffer), "Line: %ld - ", static_cast<long>( m_xLocator->getLineNumber() )); return OUString::createFromAscii( buffer ); } diff --git a/framework/source/layoutmanager/toolbarlayoutmanager.cxx b/framework/source/layoutmanager/toolbarlayoutmanager.cxx index 0811d5f..b044bad 100644 --- a/framework/source/layoutmanager/toolbarlayoutmanager.cxx +++ b/framework/source/layoutmanager/toolbarlayoutmanager.cxx @@ -482,8 +482,6 @@ bool ToolbarLayoutManager::createToolbar( const OUString& rResourceURL ) } implts_setToolbarCreation( false ); - bool bVisible( false ); - bool bFloating( false ); if ( xUIElement.is() ) { uno::Reference< awt::XWindow > xWindow( xUIElement->getRealInterface(), uno::UNO_QUERY ); @@ -503,6 +501,9 @@ bool ToolbarLayoutManager::createToolbar( const OUString& rResourceURL ) } } + bool bVisible = false; + bool bFloating = false; + /* SAFE AREA ----------------------------------------------------------------------------------------------- */ SolarMutexClearableGuard aWriteLock; @@ -1752,11 +1753,10 @@ awt::Point ToolbarLayoutManager::implts_findNextCascadeFloatingPos() awt::Point aCurrPos( aStartPos ); awt::Rectangle aRect; - vcl::Window* pContainerWindow( 0 ); if ( xContainerWindow.is() ) { SolarMutexGuard aGuard; - pContainerWindow = VCLUnoHelper::GetWindow( xContainerWindow ); + vcl::Window* pContainerWindow = VCLUnoHelper::GetWindow( xContainerWindow ); if ( pContainerWindow ) aStartPos = AWTPoint(pContainerWindow->OutputToScreenPixel(VCLPoint(aStartPos))); } @@ -2608,7 +2608,6 @@ void ToolbarLayoutManager::implts_calcDockingPosSize( aContainerWinSize = pContainerWindow->GetOutputSizePixel(); } - vcl::Window* pDockWindow( 0 ); vcl::Window* pDockingAreaWindow( 0 ); ToolBox* pToolBox( 0 ); uno::Reference< awt::XWindow > xWindow( rUIElement.m_xUIElement->getRealInterface(), uno::UNO_QUERY ); @@ -2633,7 +2632,7 @@ void ToolbarLayoutManager::implts_calcDockingPosSize( { SolarMutexGuard aGuard; pDockingAreaWindow = VCLUnoHelper::GetWindow( xDockingAreaWindow ); - pDockWindow = VCLUnoHelper::GetWindow( xWindow ); + vcl::Window* pDockWindow = VCLUnoHelper::GetWindow( xWindow ); if ( pDockWindow && pDockWindow->GetType() == WINDOW_TOOLBOX ) pToolBox = static_cast<ToolBox *>(pDockWindow); @@ -3068,11 +3067,10 @@ framework::ToolbarLayoutManager::DockingOperation ToolbarLayoutManager::implts_d sal_Int32 nDockPosY( 0 ); vcl::Window* pDockingAreaWindow( 0 ); - vcl::Window* pContainerWindow( 0 ); { SolarMutexGuard aGuard; pDockingAreaWindow = VCLUnoHelper::GetWindow( xDockingAreaWindow ); - pContainerWindow = VCLUnoHelper::GetWindow( xContainerWindow ); + vcl::Window* pContainerWindow = VCLUnoHelper::GetWindow( xContainerWindow ); nDockPosY = pDockingAreaWindow->ScreenToOutputPixel( pContainerWindow->OutputToScreenPixel( ::Point( 0, nPosY ))).Y(); } @@ -3263,7 +3261,6 @@ throw (uno::RuntimeException, std::exception) aReadGuard.clear(); vcl::Window* pContainerWindow( 0 ); - vcl::Window* pWindow( 0 ); ::Point aMousePos; { SolarMutexGuard aGuard; @@ -3289,7 +3286,7 @@ throw (uno::RuntimeException, std::exception) SolarMutexGuard aGuard; - pWindow = VCLUnoHelper::GetWindow( xWindow ); + vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); if ( pWindow && pWindow->GetType() == WINDOW_TOOLBOX ) { ToolBox* pToolBox = static_cast<ToolBox *>(pWindow); diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx index 23e0c27..4fe9415 100644 --- a/framework/source/uielement/menubarmanager.cxx +++ b/framework/source/uielement/menubarmanager.cxx @@ -1620,8 +1620,6 @@ void MenuBarManager::FillMenu( OUString aLabel; OUString aHelpURL; OUString aModuleIdentifier( rModuleIdentifier ); - bool bShow(true); - bool bEnabled(true); sal_uInt16 nType = 0; Reference< XIndexAccess > xIndexContainer; Reference< XDispatchProvider > xDispatchProvider( rDispatchProvider ); @@ -1630,6 +1628,9 @@ void MenuBarManager::FillMenu( { if ( rItemContainer->getByIndex( n ) >>= aProp ) { + bool bShow = true; + bool bEnabled = true; + for ( int i = 0; i < aProp.getLength(); i++ ) { OUString aPropName = aProp[i].Name; diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx index c966532..ca8309b 100644 --- a/framework/source/uielement/toolbarmanager.cxx +++ b/framework/source/uielement/toolbarmanager.cxx @@ -1204,7 +1204,6 @@ void ToolBarManager::FillToolbar( const Reference< XIndexAccess >& rItemContaine OUString aTooltip; sal_uInt16 nType( ::com::sun::star::ui::ItemType::DEFAULT ); sal_uInt16 nWidth( 0 ); - bool bIsVisible( true ); sal_uInt32 nStyle( 0 ); Reference< XIndexAccess > aMenuDesc; @@ -1212,6 +1211,7 @@ void ToolBarManager::FillToolbar( const Reference< XIndexAccess >& rItemContaine { if ( rItemContainer->getByIndex( n ) >>= aProp ) { + bool bIsVisible( true ); for ( int i = 0; i < aProp.getLength(); i++ ) { if ( aProp[i].Name == ITEM_DESCRIPTOR_COMMANDURL ) diff --git a/framework/source/uielement/toolbarsmenucontroller.cxx b/framework/source/uielement/toolbarsmenucontroller.cxx index ebbb01c..ac16ea6 100644 --- a/framework/source/uielement/toolbarsmenucontroller.cxx +++ b/framework/source/uielement/toolbarsmenucontroller.cxx @@ -379,10 +379,11 @@ void ToolbarsMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu >& r OUString aUIName = pIter->second; bool bHideFromMenu( false ); bool bContextSensitive( false ); - bool bVisible( false ); if ( aUIName.isEmpty() && m_xPersistentWindowState.is() ) { + bool bVisible( false ); + try { Sequence< PropertyValue > aWindowState;
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits