Kaydet (Commit) 38b8c1e8 authored tarafından Michael Weghorn's avatar Michael Weghorn Kaydeden (comit) Caolán McNamara

fdo#39440 reduce scope of local variables

This addresses some cppcheck warnings.

Change-Id: I57f336c6ab3c418eac82397edeadecb4c1b168a7
Reviewed-on: https://gerrit.libreoffice.org/13495Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst d4165675
......@@ -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(); )
......
......@@ -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 );
......
......@@ -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 );
}
......
......@@ -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 );
}
......
......@@ -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 );
}
......
......@@ -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);
......
......@@ -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;
......
......@@ -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 )
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment