summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2015-01-14 17:42:29 +0000
committerCaolán McNamara <caolanm@redhat.com>2015-01-14 20:43:30 +0000
commitba3f0cfecdddf0275278987a75b5ee620744eb84 (patch)
tree11d58aaa374d9e7cf048c5687e6bb777bedd9099 /svx
parentc752d8bdf099b4ba2ef2e145e0d9da42ba7e74d7 (diff)
fdo#39440 svx: reduce scope of local variables
This addresses some cppcheck warnings. Change-Id: I800242bbac3092d2dbaa9098fc6355fe675872e1 Reviewed-on: https://gerrit.libreoffice.org/13906 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svx')
-rw-r--r--svx/source/dialog/_bmpmask.cxx11
-rw-r--r--svx/source/dialog/dlgctrl.cxx21
-rw-r--r--svx/source/dialog/srchdlg.cxx4
-rw-r--r--svx/source/engine3d/float3d.cxx3
-rw-r--r--svx/source/fmcomp/fmgridcl.cxx3
-rw-r--r--svx/source/fmcomp/fmgridif.cxx3
-rw-r--r--svx/source/fmcomp/gridctrl.cxx3
-rw-r--r--svx/source/form/datanavi.cxx3
-rw-r--r--svx/source/form/fmshimp.cxx3
-rw-r--r--svx/source/form/navigatortree.cxx9
-rw-r--r--svx/source/form/navigatortreemodel.cxx3
11 files changed, 24 insertions, 42 deletions
diff --git a/svx/source/dialog/_bmpmask.cxx b/svx/source/dialog/_bmpmask.cxx
index 75668ce3d29f..4c00773cb36c 100644
--- a/svx/source/dialog/_bmpmask.cxx
+++ b/svx/source/dialog/_bmpmask.cxx
@@ -701,16 +701,14 @@ GDIMetaFile SvxBmpMask::ImpMask( const GDIMetaFile& rMtf )
Color pDstCols[4];
sal_uIntPtr pTols[4];
sal_uInt16 nCount = InitColorArrays( pSrcCols, pDstCols, pTols );
- bool pTrans[4];
// If no color is selected, we copy only the Mtf
if( !nCount )
aMtf = rMtf;
else
{
+ bool pTrans[4];
Color aCol;
- long nVal;
- long nTol;
long nR;
long nG;
long nB;
@@ -721,7 +719,6 @@ GDIMetaFile SvxBmpMask::ImpMask( const GDIMetaFile& rMtf )
boost::scoped_array<long> pMinB(new long[nCount]);
boost::scoped_array<long> pMaxB(new long[nCount]);
sal_uInt16 i;
- bool bReplace;
aMtf.SetPrefSize( rMtf.GetPrefSize() );
aMtf.SetPrefMapMode( rMtf.GetPrefMapMode() );
@@ -729,9 +726,9 @@ GDIMetaFile SvxBmpMask::ImpMask( const GDIMetaFile& rMtf )
// Prepare Color comparison array
for( i = 0; i < nCount; i++ )
{
- nTol = ( pTols[i] * 255L ) / 100L;
+ long nTol = ( pTols[i] * 255L ) / 100L;
- nVal = ( (long) pSrcCols[i].GetRed() );
+ long nVal = ( (long) pSrcCols[i].GetRed() );
pMinR[i] = std::max( nVal - nTol, 0L );
pMaxR[i] = std::min( nVal + nTol, 255L );
@@ -751,7 +748,7 @@ GDIMetaFile SvxBmpMask::ImpMask( const GDIMetaFile& rMtf )
{
MetaAction* pAction = rMtf.GetAction( nAct );
- bReplace = false;
+ bool bReplace = false;
switch( pAction->GetType() )
{
diff --git a/svx/source/dialog/dlgctrl.cxx b/svx/source/dialog/dlgctrl.cxx
index 2ecdcf8e7d38..c03b68896428 100644
--- a/svx/source/dialog/dlgctrl.cxx
+++ b/svx/source/dialog/dlgctrl.cxx
@@ -1151,12 +1151,11 @@ void ColorLB::Fill( const XColorListRef &pColorTab )
return;
long nCount = pColorTab->Count();
- XColorEntry* pEntry;
SetUpdateMode( false );
for( long i = 0; i < nCount; i++ )
{
- pEntry = pColorTab->GetColor( i );
+ XColorEntry* pEntry = pColorTab->GetColor( i );
InsertEntry( pEntry->GetColor(), pEntry->GetName() );
}
@@ -1181,12 +1180,11 @@ void ColorLB::Modify( const XColorEntry& rEntry, sal_Int32 nPos )
void FillAttrLB::Fill( const XColorListRef &pColorTab )
{
long nCount = pColorTab->Count();
- XColorEntry* pEntry;
SetUpdateMode( false );
for( long i = 0; i < nCount; i++ )
{
- pEntry = pColorTab->GetColor( i );
+ XColorEntry* pEntry = pColorTab->GetColor( i );
InsertEntry( pEntry->GetColor(), pEntry->GetName() );
}
@@ -1272,12 +1270,11 @@ void HatchingLB::Modify( const XHatchEntry& rEntry, sal_Int32 nPos, const Bitmap
void FillAttrLB::Fill( const XHatchListRef &pList )
{
long nCount = pList->Count();
- XHatchEntry* pEntry;
ListBox::SetUpdateMode( false );
for( long i = 0; i < nCount; i++ )
{
- pEntry = pList->GetHatch( i );
+ XHatchEntry* pEntry = pList->GetHatch( i );
const Bitmap aBitmap = pList->GetUiBitmap( i );
if( !aBitmap.IsEmpty() )
ListBox::InsertEntry(pEntry->GetName(), Image(aBitmap));
@@ -1315,14 +1312,13 @@ void GradientLB::Fill( const XGradientListRef &pList )
return;
mpList = pList;
- XGradientEntry* pEntry;
long nCount = pList->Count();
SetUpdateMode( false );
for( long i = 0; i < nCount; i++ )
{
- pEntry = pList->GetGradient( i );
+ XGradientEntry* pEntry = pList->GetGradient( i );
const Bitmap aBitmap = pList->GetUiBitmap( i );
if( !aBitmap.IsEmpty() )
InsertEntry(pEntry->GetName(), Image(aBitmap));
@@ -1389,12 +1385,11 @@ void GradientLB::SelectEntryByList( const XGradientListRef &pList, const OUStrin
void FillAttrLB::Fill( const XGradientListRef &pList )
{
long nCount = pList->Count();
- XGradientEntry* pEntry;
ListBox::SetUpdateMode( false );
for( long i = 0; i < nCount; i++ )
{
- pEntry = pList->GetGradient( i );
+ XGradientEntry* pEntry = pList->GetGradient( i );
const Bitmap aBitmap = pList->GetUiBitmap( i );
if( !aBitmap.IsEmpty() )
ListBox::InsertEntry(pEntry->GetName(), Image(aBitmap));
@@ -1634,12 +1629,11 @@ void LineLB::Fill( const XDashListRef &pList )
// entries for dashed lines
long nCount = pList->Count();
- XDashEntry* pEntry;
SetUpdateMode( false );
for( long i = 0; i < nCount; i++ )
{
- pEntry = pList->GetDash( i );
+ XDashEntry* pEntry = pList->GetDash( i );
const Bitmap aBitmap = pList->GetUiBitmap( i );
if( !aBitmap.IsEmpty() )
{
@@ -1713,13 +1707,12 @@ void LineEndLB::Fill( const XLineEndListRef &pList, bool bStart )
return;
long nCount = pList->Count();
- XLineEndEntry* pEntry;
VirtualDevice aVD;
SetUpdateMode( false );
for( long i = 0; i < nCount; i++ )
{
- pEntry = pList->GetLineEnd( i );
+ XLineEndEntry* pEntry = pList->GetLineEnd( i );
const Bitmap aBitmap = pList->GetUiBitmap( i );
if( !aBitmap.IsEmpty() )
{
diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx
index 1118a09f856d..d4368985e5b9 100644
--- a/svx/source/dialog/srchdlg.cxx
+++ b/svx/source/dialog/srchdlg.cxx
@@ -1901,9 +1901,10 @@ IMPL_LINK_NOARG(SvxSearchDialog, FormatHdl_Impl)
SearchAttrItemList* pList = bSearch ? pSearchList : pReplaceList;
- SearchAttrItem* pAItem;
const SfxPoolItem* pItem;
for( sal_uInt16 n = 0; n < pList->Count(); ++n )
+ {
+ SearchAttrItem* pAItem;
if( !IsInvalidItem( (pAItem = &pList->GetObject(n))->pItem ) &&
SfxItemState::SET == aOutSet.GetItemState(
pAItem->pItem->Which(), false, &pItem ) )
@@ -1912,6 +1913,7 @@ IMPL_LINK_NOARG(SvxSearchDialog, FormatHdl_Impl)
pAItem->pItem = pItem->Clone();
aOutSet.ClearItem( pAItem->pItem->Which() );
}
+ }
if( aOutSet.Count() )
pList->Put( aOutSet );
diff --git a/svx/source/engine3d/float3d.cxx b/svx/source/engine3d/float3d.cxx
index e8fa22d3a88f..947a019428ff 100644
--- a/svx/source/engine3d/float3d.cxx
+++ b/svx/source/engine3d/float3d.cxx
@@ -2277,10 +2277,9 @@ IMPL_LINK( Svx3DWin, ClickViewTypeHdl, void *, pBtn )
IMPL_LINK( Svx3DWin, ClickHdl, PushButton *, pBtn )
{
- bool bUpdatePreview = false;
-
if( pBtn )
{
+ bool bUpdatePreview = false;
sal_uInt16 nSId = 0;
if( pBtn == m_pBtnConvertTo3D )
diff --git a/svx/source/fmcomp/fmgridcl.cxx b/svx/source/fmcomp/fmgridcl.cxx
index d625b17de678..a611b540a37b 100644
--- a/svx/source/fmcomp/fmgridcl.cxx
+++ b/svx/source/fmcomp/fmgridcl.cxx
@@ -747,7 +747,6 @@ void FmGridHeader::PreExecuteColumnContextMenu(sal_uInt16 nColId, PopupMenu& rMe
bAllowHide = bAllowHide && (xCols->getCount()-nHiddenCols > 1); // AND there are at least two visible columns
rMenu.EnableItem(SID_FM_HIDECOL, bAllowHide);
- bool bChecked = false;
if (bMarked)
{
@@ -761,7 +760,7 @@ void FmGridHeader::PreExecuteColumnContextMenu(sal_uInt16 nColId, PopupMenu& rMe
if (eState >= SfxItemState::DEFAULT && pItem )
{
- bChecked = pItem->ISA(SfxBoolItem) && static_cast<SfxBoolItem*>(pItem)->GetValue();
+ bool bChecked = pItem->ISA(SfxBoolItem) && static_cast<SfxBoolItem*>(pItem)->GetValue();
rMenu.CheckItem(SID_FM_SHOW_PROPERTY_BROWSER,bChecked);
}
delete pItem;
diff --git a/svx/source/fmcomp/fmgridif.cxx b/svx/source/fmcomp/fmgridif.cxx
index 5fb30f03908b..8532774db6d2 100644
--- a/svx/source/fmcomp/fmgridif.cxx
+++ b/svx/source/fmcomp/fmgridif.cxx
@@ -1332,7 +1332,6 @@ Sequence< Any > SAL_CALL FmXGridPeer::queryFieldData( sal_Int32 nRow, const Type
bool bRequestedAsAny = (xType.getTypeClass() == TypeClass_ANY);
Reference< ::com::sun::star::sdb::XColumn > xFieldContent;
- DbGridColumn* pCol;
for (sal_Int32 i=0; i < nColumnCount; ++i)
{
sal_uInt16 nModelPos = pGrid->GetModelColumnPos(pGrid->GetColumnIdFromViewPos((sal_uInt16)i));
@@ -1340,7 +1339,7 @@ Sequence< Any > SAL_CALL FmXGridPeer::queryFieldData( sal_Int32 nRow, const Type
// don't use GetCurrentFieldValue to determine the field content as this isn't affected by the above SeekRow
// FS - 30.09.99 - 68644
- pCol = aColumns[ nModelPos ];
+ DbGridColumn* pCol = aColumns[ nModelPos ];
xFieldContent = xPaintRow->HasField( pCol->GetFieldPos() )
? xPaintRow->GetField( pCol->GetFieldPos() ).getColumn()
: Reference< XColumn > ();
diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx
index 37d1b41b766b..777045da3ad9 100644
--- a/svx/source/fmcomp/gridctrl.cxx
+++ b/svx/source/fmcomp/gridctrl.cxx
@@ -767,12 +767,11 @@ DbGridRow::DbGridRow(CursorWrapper* pCur, bool bPaintCursor)
if (pCur && pCur->Is())
{
Reference< XIndexAccess > xColumns(pCur->getColumns(), UNO_QUERY);
- DataColumn* pColumn;
for (sal_Int32 i = 0; i < xColumns->getCount(); ++i)
{
Reference< XPropertySet > xColSet(
xColumns->getByIndex(i), css::uno::UNO_QUERY);
- pColumn = new DataColumn(xColSet);
+ DataColumn* pColumn = new DataColumn(xColSet);
m_aVariants.push_back( pColumn );
}
diff --git a/svx/source/form/datanavi.cxx b/svx/source/form/datanavi.cxx
index f468add93d61..96be6c0f17a1 100644
--- a/svx/source/form/datanavi.cxx
+++ b/svx/source/form/datanavi.cxx
@@ -867,14 +867,13 @@ namespace svxform
void XFormsPage::EditEntry( const Reference< XPropertySet >& _rEntry )
{
- SvTreeListEntry* pEntry = NULL;
OUString sTemp;
if ( DGTSubmission == m_eGroup )
{
try
{
- pEntry = m_pItemList->FirstSelected();
+ SvTreeListEntry* pEntry = m_pItemList->FirstSelected();
// #i36262# may be called for submission entry *or* for
// submission children. If we don't have any children, we
diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx
index 0a3f8a4161fe..3ba69ccd7c1b 100644
--- a/svx/source/form/fmshimp.cxx
+++ b/svx/source/form/fmshimp.cxx
@@ -3880,11 +3880,10 @@ void FmXFormShell::loadForms( FmFormPage* _pPage, const sal_uInt16 _nBehaviour /
if ( xForms.is() )
{
Reference< XLoadable > xForm;
- bool bFormWasLoaded = false;
for ( sal_Int32 j = 0, nCount = xForms->getCount(); j < nCount; ++j )
{
xForms->getByIndex( j ) >>= xForm;
- bFormWasLoaded = false;
+ bool bFormWasLoaded = false;
// a database form must be loaded for
try
{
diff --git a/svx/source/form/navigatortree.cxx b/svx/source/form/navigatortree.cxx
index 879e390f084f..7ba0bf774c0a 100644
--- a/svx/source/form/navigatortree.cxx
+++ b/svx/source/form/navigatortree.cxx
@@ -532,10 +532,9 @@ namespace svxform
{
if( !pEntryData ) return NULL;
SvTreeListEntry* pCurEntry = First();
- FmEntryData* pCurEntryData;
while( pCurEntry )
{
- pCurEntryData = (FmEntryData*)pCurEntry->GetUserData();
+ FmEntryData* pCurEntryData = (FmEntryData*)pCurEntry->GetUserData();
if( pCurEntryData && pCurEntryData->IsEqualWithoutChildren(pEntryData) )
return pCurEntry;
@@ -633,10 +632,9 @@ namespace svxform
// insert children
FmEntryDataList* pChildList = pEntryData->GetChildList();
size_t nChildCount = pChildList->size();
- FmEntryData* pChildData;
for( size_t i = 0; i < nChildCount; i++ )
{
- pChildData = pChildList->at( i );
+ FmEntryData* pChildData = pChildList->at( i );
Insert( pChildData, TREELIST_APPEND );
}
@@ -2109,11 +2107,10 @@ namespace svxform
void NavigatorTree::CollectObjects(FmFormData* pFormData, bool bDeep, ::std::set< Reference< XFormComponent > >& _rObjects)
{
FmEntryDataList* pChildList = pFormData->GetChildList();
- FmEntryData* pEntryData;
FmControlData* pControlData;
for( size_t i = 0; i < pChildList->size(); ++i )
{
- pEntryData = pChildList->at( i );
+ FmEntryData* pEntryData = pChildList->at( i );
if( pEntryData->ISA(FmControlData) )
{
pControlData = static_cast<FmControlData*>(pEntryData);
diff --git a/svx/source/form/navigatortreemodel.cxx b/svx/source/form/navigatortreemodel.cxx
index ebeedc2238dd..95bc82438dcb 100644
--- a/svx/source/form/navigatortreemodel.cxx
+++ b/svx/source/form/navigatortreemodel.cxx
@@ -518,14 +518,13 @@ namespace svxform
return;
Reference< XForm > xSubForm;
- FmFormData* pSubFormData;
for (sal_Int32 i=0; i<xForms->getCount(); ++i)
{
DBG_ASSERT( xForms->getByIndex(i).getValueType() == cppu::UnoType<XForm>::get(),
"NavigatorTreeModel::FillBranch : the root container should supply only elements of type XForm");
xForms->getByIndex(i) >>= xSubForm;
- pSubFormData = new FmFormData( xSubForm, m_aNormalImages, pFormData );
+ FmFormData* pSubFormData = new FmFormData( xSubForm, m_aNormalImages, pFormData );
Insert( pSubFormData, CONTAINER_APPEND );