summaryrefslogtreecommitdiff
path: root/sfx2/source/control
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2014-12-22 17:57:48 +0100
committerNoel Grandin <noelgrandin@gmail.com>2014-12-23 05:53:41 +0000
commitea644f0e90d0c9585e73bdec240908803a38d4a6 (patch)
treedf140769eaf45d4205d4ac50147809597e3e6d73 /sfx2/source/control
parenta6c0583675b6fe4210ae8249728fe5d4df125f5c (diff)
fdo#39440 reduce scope of local variables
This addresses some cppcheck warnings. Change-Id: I404f121ee2e5020359a662f54ffe341f466cd1d5 Reviewed-on: https://gerrit.libreoffice.org/13608 Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'sfx2/source/control')
-rw-r--r--sfx2/source/control/dispatch.cxx6
-rw-r--r--sfx2/source/control/statcach.cxx8
-rw-r--r--sfx2/source/control/templatelocalview.cxx3
3 files changed, 9 insertions, 8 deletions
diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx
index 4cf4e01d990e..b42f32aba37f 100644
--- a/sfx2/source/control/dispatch.cxx
+++ b/sfx2/source/control/dispatch.cxx
@@ -887,13 +887,12 @@ const SfxSlot* SfxDispatcher::GetSlot( const OUString& rCommand )
}
}
- const SfxSlot *pSlot=NULL;
sal_uInt16 nFirstShell = 0;
for ( sal_uInt16 i = nFirstShell; i < nTotCount; ++i )
{
SfxShell *pObjShell = GetShell(i);
SfxInterface *pIFace = pObjShell->GetInterface();
- pSlot = pIFace->GetSlot( rCommand );
+ const SfxSlot *pSlot = pIFace->GetSlot( rCommand );
if ( pSlot )
return pSlot;
}
@@ -1262,7 +1261,6 @@ void SfxDispatcher::_Update_Impl( bool bUIActive, bool bIsMDIApp, bool bIsIPOwne
SfxGetpApp();
SfxWorkWindow *pWorkWin = pImp->pFrame->GetFrame().GetWorkWindow_Impl();
bool bIsActive = false;
- bool bIsTaskActive = false;
SfxDispatcher *pActDispat = pWorkWin->GetBindings().GetDispatcher_Impl();
SfxDispatcher *pDispat = this;
while ( pActDispat && !bIsActive )
@@ -1401,6 +1399,8 @@ void SfxDispatcher::_Update_Impl( bool bUIActive, bool bIsMDIApp, bool bIsIPOwne
if ( pTaskWin && ( bIsMDIApp || bIsIPOwner ) )
{
+ bool bIsTaskActive = false;
+
SfxDispatcher *pActDispatcher = pTaskWin->GetBindings().GetDispatcher_Impl();
SfxDispatcher *pDispatcher = this;
while ( pActDispatcher && !bIsTaskActive )
diff --git a/sfx2/source/control/statcach.cxx b/sfx2/source/control/statcach.cxx
index b74442221884..9a679e66853a 100644
--- a/sfx2/source/control/statcach.cxx
+++ b/sfx2/source/control/statcach.cxx
@@ -343,12 +343,12 @@ void SfxStateCache::SetState
void SfxStateCache::SetVisibleState( bool bShow )
{
- SfxItemState eState( SfxItemState::DEFAULT );
- const SfxPoolItem* pState( NULL );
- bool bDeleteItem( false );
-
if ( bShow != bItemVisible )
{
+ SfxItemState eState( SfxItemState::DEFAULT );
+ const SfxPoolItem* pState( NULL );
+ bool bDeleteItem( false );
+
bItemVisible = bShow;
if ( bShow )
{
diff --git a/sfx2/source/control/templatelocalview.cxx b/sfx2/source/control/templatelocalview.cxx
index ea3ed0249991..7fa5f064ad4f 100644
--- a/sfx2/source/control/templatelocalview.cxx
+++ b/sfx2/source/control/templatelocalview.cxx
@@ -469,7 +469,6 @@ bool TemplateLocalView::moveTemplates(const std::set<const ThumbnailViewItem*, s
assert(mnCurRegionId); // Only allowed in non root regions
bool ret = true;
- bool refresh = false;
sal_uInt16 nSrcRegionId = mnCurRegionId-1;
@@ -486,6 +485,8 @@ bool TemplateLocalView::moveTemplates(const std::set<const ThumbnailViewItem*, s
if (pTarget && pSrc)
{
+ bool refresh = false;
+
sal_uInt16 nTargetRegion = pTarget->mnRegionId;
sal_uInt16 nTargetIdx = mpDocTemplates->GetCount(nTargetRegion); // Next Idx
std::vector<sal_uInt16> aItemIds; // List of moved items ids (also prevents the invalidation of rItems iterators when we remove them as we go)