summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2015-01-15 17:16:31 +0000
committerBjörn Michaelsen <bjoern.michaelsen@canonical.com>2015-01-16 08:59:45 +0000
commitccaa5519cb978a640caa22ce2bcbd6c54fa44e26 (patch)
tree1ff2d99d03a16ab14e41f89b919ff2d5cde925f9 /sw
parent0ffb225d374cfda29275db3c22a9866eb5fe5ad2 (diff)
fdo#39440 sw: reduce scope of local variables
This addresses some cppcheck warnings. Change-Id: I4c55c109f81407d5383932e4254e0f5f61d12cd7 Reviewed-on: https://gerrit.libreoffice.org/13939 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Björn Michaelsen <bjoern.michaelsen@canonical.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/access/accmap.cxx3
-rw-r--r--sw/source/core/access/accpara.cxx3
-rw-r--r--sw/source/core/access/acctable.cxx14
-rw-r--r--sw/source/core/bastyp/bparr.cxx3
-rw-r--r--sw/source/core/bastyp/init.cxx4
-rw-r--r--sw/source/core/crsr/crstrvl.cxx7
-rw-r--r--sw/source/core/doc/CntntIdxStore.cxx2
-rw-r--r--sw/source/core/doc/DocumentContentOperationsManager.cxx3
-rw-r--r--sw/source/core/doc/DocumentStatisticsManager.cxx2
-rw-r--r--sw/source/core/doc/doc.cxx14
-rw-r--r--sw/source/core/doc/docbasic.cxx4
-rw-r--r--sw/source/core/doc/docchart.cxx4
-rw-r--r--sw/source/core/doc/docdraw.cxx3
-rw-r--r--sw/source/core/doc/docedt.cxx3
-rw-r--r--sw/source/core/doc/docfld.cxx2
-rw-r--r--sw/source/core/doc/doclay.cxx12
-rw-r--r--sw/source/core/doc/docnum.cxx3
-rw-r--r--sw/source/core/doc/fmtcol.cxx2
-rw-r--r--sw/source/core/doc/gctable.cxx4
-rw-r--r--sw/source/core/doc/number.cxx7
-rw-r--r--sw/source/core/doc/tblrwcl.cxx6
-rw-r--r--sw/source/core/docnode/ndsect.cxx4
-rw-r--r--sw/source/core/docnode/ndtbl.cxx10
-rw-r--r--sw/source/core/docnode/node.cxx8
24 files changed, 73 insertions, 54 deletions
diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx
index 40eebd5f89e3..5b41a9cae49e 100644
--- a/sw/source/core/access/accmap.cxx
+++ b/sw/source/core/access/accmap.cxx
@@ -1277,13 +1277,12 @@ void SwAccessibleMap::InvalidateShapeInParaSelection()
const SwFrm *pFrm = (*aIter).first;
if(pFrm->IsFlyFrm())
{
- bool bFrmChanged = false;
uno::Reference < XAccessible > xAcc = (*aIter).second;
if(xAcc.is())
{
SwAccessibleFrameBase *pAccFrame = (static_cast< SwAccessibleFrameBase * >(xAcc.get()));
- bFrmChanged = pAccFrame->SetSelectedState( true );
+ bool bFrmChanged = pAccFrame->SetSelectedState( true );
if (bFrmChanged)
{
const SwFlyFrm *pFlyFrm = static_cast< const SwFlyFrm * >( pFrm );
diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx
index b16f06a17e05..e01e23d6642b 100644
--- a/sw/source/core/access/accpara.cxx
+++ b/sw/source/core/access/accpara.cxx
@@ -3390,7 +3390,6 @@ sal_Bool SAL_CALL SwAccessibleParagraph::removeSelection( sal_Int32 selectionInd
if(selectionIndex < 0) return sal_False;
- bool bRet = false;
sal_Int32 nSelected = selectionIndex;
// get the selection, and test whether it affects our text node
@@ -3398,6 +3397,8 @@ sal_Bool SAL_CALL SwAccessibleParagraph::removeSelection( sal_Int32 selectionInd
if( pCrsr != NULL )
{
+ bool bRet = false;
+
// get SwPosition for my node
const SwTxtNode* pNode = GetTxtNode();
sal_uLong nHere = pNode->GetIndex();
diff --git a/sw/source/core/access/acctable.cxx b/sw/source/core/access/acctable.cxx
index 629e08d3a554..358296262c8e 100644
--- a/sw/source/core/access/acctable.cxx
+++ b/sw/source/core/access/acctable.cxx
@@ -1791,11 +1791,10 @@ sal_Bool SAL_CALL SwAccessibleTable::selectRow( sal_Int32 row )
if( isAccessibleColumnSelected( row ) )
return sal_True;
- long lCol, lColumnCount, lChildIndex;
- lColumnCount = getAccessibleColumnCount();
- for(lCol = 0; lCol < lColumnCount; lCol ++)
+ long lColumnCount = getAccessibleColumnCount();
+ for(long lCol = 0; lCol < lColumnCount; lCol ++)
{
- lChildIndex = getAccessibleIndex(row, lCol);
+ long lChildIndex = getAccessibleIndex(row, lCol);
selectAccessibleChild(lChildIndex);
}
@@ -1809,12 +1808,11 @@ sal_Bool SAL_CALL SwAccessibleTable::selectColumn( sal_Int32 column )
if( isAccessibleColumnSelected( column ) )
return sal_True;
- long lRow, lRowCount, lChildIndex;
- lRowCount = getAccessibleRowCount();
+ long lRowCount = getAccessibleRowCount();
- for(lRow = 0; lRow < lRowCount; lRow ++)
+ for(long lRow = 0; lRow < lRowCount; lRow ++)
{
- lChildIndex = getAccessibleIndex(lRow, column);
+ long lChildIndex = getAccessibleIndex(lRow, column);
selectAccessibleChild(lChildIndex);
}
return sal_True;
diff --git a/sw/source/core/bastyp/bparr.cxx b/sw/source/core/bastyp/bparr.cxx
index 64ddf750235f..605315663701 100644
--- a/sw/source/core/bastyp/bparr.cxx
+++ b/sw/source/core/bastyp/bparr.cxx
@@ -141,10 +141,9 @@ void BigPtrArray::UpdIndex( sal_uInt16 pos )
{
BlockInfo** pp = ppInf + pos;
sal_uLong idx = (*pp)->nEnd + 1;
- BlockInfo* p;
while( ++pos < nBlock )
{
- p = *++pp;
+ BlockInfo* p = *++pp;
p->nStart = idx;
idx += p->nElem;
p->nEnd = idx - 1;
diff --git a/sw/source/core/bastyp/init.cxx b/sw/source/core/bastyp/init.cxx
index dc3efadc708e..697309c7e81d 100644
--- a/sw/source/core/bastyp/init.cxx
+++ b/sw/source/core/bastyp/init.cxx
@@ -809,10 +809,12 @@ void _FinitCore()
delete SwStyleNameMapper::pNumRuleProgMap;
// delete all default attributes
- SfxPoolItem* pHt;
for( sal_uInt16 n = 0; n < POOLATTR_END - POOLATTR_BEGIN; n++ )
+ {
+ SfxPoolItem* pHt;
if( 0 != ( pHt = aAttrTab[n] ))
delete pHt;
+ }
::ClearFEShellTabCols();
diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx
index 5f1e4f3b70d0..f72283c0a258 100644
--- a/sw/source/core/crsr/crstrvl.cxx
+++ b/sw/source/core/crsr/crstrvl.cxx
@@ -510,13 +510,15 @@ bool SwCrsrShell::GotoNxtPrvTOXMark( bool bNext )
GetCntntNode()->getLayoutFrm( GetLayout(), &aPt, &rPos, false ) );
{
- const SfxPoolItem* pItem;
- const SwCntntFrm* pCFrm;
const SwTxtNode* pTxtNd;
const SwTxtTOXMark* pTxtTOX;
sal_uInt32 n, nMaxItems = GetDoc()->GetAttrPool().GetItemCount2( RES_TXTATR_TOXMARK );
for( n = 0; n < nMaxItems; ++n )
+ {
+ const SfxPoolItem* pItem;
+ const SwCntntFrm* pCFrm;
+
if( 0 != (pItem = GetDoc()->GetAttrPool().GetItem2(
RES_TXTATR_TOXMARK, n ) ) &&
0 != (pTxtTOX = static_cast<const SwTOXMark*>(pItem)->GetTxtTOXMark() ) &&
@@ -535,6 +537,7 @@ bool SwCrsrShell::GotoNxtPrvTOXMark( bool bNext )
bFnd = true;
}
}
+ }
}
if( bFnd )
diff --git a/sw/source/core/doc/CntntIdxStore.cxx b/sw/source/core/doc/CntntIdxStore.cxx
index 1f752adb3c5e..439b1b33e6fd 100644
--- a/sw/source/core/doc/CntntIdxStore.cxx
+++ b/sw/source/core/doc/CntntIdxStore.cxx
@@ -319,13 +319,13 @@ void CntntIdxStoreImpl::SaveFlys(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nCntnt,
{
if ( RES_FLYFRMFMT == pFrmFmt->Which() || RES_DRAWFRMFMT == pFrmFmt->Which() )
{
- bool bSkip = false;
const SwFmtAnchor& rAnchor = pFrmFmt->GetAnchor();
SwPosition const*const pAPos = rAnchor.GetCntntAnchor();
if ( pAPos && ( nNode == pAPos->nNode.GetIndex() ) &&
( FLY_AT_PARA == rAnchor.GetAnchorId() ||
FLY_AT_CHAR == rAnchor.GetAnchorId() ) )
{
+ bool bSkip = false;
aSave.m_bOther = false;
aSave.m_nCntnt = pAPos->nContent.GetIndex();
if ( FLY_AT_CHAR == rAnchor.GetAnchorId() )
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index 30d2fbc5dca8..9b8f594d9e29 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -1510,11 +1510,10 @@ namespace //local functions originally from docfmt.cxx
if( pHistory )
{
SwRegHistory aRegH( pNode, *pNode, pHistory );
- SwpHints *pSwpHints;
if( pTNd && pCharSet && pCharSet->Count() )
{
- pSwpHints = bCreateSwpHints ? &pTNd->GetOrCreateSwpHints()
+ SwpHints *pSwpHints = bCreateSwpHints ? &pTNd->GetOrCreateSwpHints()
: pTNd->GetpSwpHints();
if( pSwpHints )
pSwpHints->Register( &aRegH );
diff --git a/sw/source/core/doc/DocumentStatisticsManager.cxx b/sw/source/core/doc/DocumentStatisticsManager.cxx
index 3f6ccb4d5ce0..e71f3c7e9f97 100644
--- a/sw/source/core/doc/DocumentStatisticsManager.cxx
+++ b/sw/source/core/doc/DocumentStatisticsManager.cxx
@@ -132,11 +132,11 @@ bool DocumentStatisticsManager::IncrementalDocStatCalculate(long nChars, bool bF
{
mpDocStat->Reset();
mpDocStat->nPara = 0; // default is 1!
- SwNode* pNd;
// This is the inner loop - at least while the paras are dirty.
for( sal_uLong i = m_rDoc.GetNodes().Count(); i > 0 && nChars > 0; )
{
+ SwNode* pNd;
switch( ( pNd = m_rDoc.GetNodes()[ --i ])->GetNodeType() )
{
case ND_TEXTNODE:
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index 1ae97f64d8e6..c81800b51ae3 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -557,9 +557,9 @@ bool sw_GetPostIts(
{
// Found modify object; insert all fields into the array
SwIterator<SwFmtFld,SwFieldType> aIter( *pFldType );
- const SwTxtFld* pTxtFld;
for( SwFmtFld* pFld = aIter.First(); pFld; pFld = aIter.Next() )
{
+ const SwTxtFld* pTxtFld;
if( 0 != ( pTxtFld = pFld->GetTxtFld() ) &&
pTxtFld->GetTxtNode().GetNodes().IsDocNodes() )
{
@@ -1014,10 +1014,10 @@ void SwDoc::CalculatePagePairsForProspectPrinting(
/// @return the reference in the doc for the name
const SwFmtRefMark* SwDoc::GetRefMark( const OUString& rName ) const
{
- const SfxPoolItem* pItem;
sal_uInt32 nMaxItems = GetAttrPool().GetItemCount2( RES_TXTATR_REFMARK );
for( sal_uInt32 n = 0; n < nMaxItems; ++n )
{
+ const SfxPoolItem* pItem;
if( 0 == (pItem = GetAttrPool().GetItem2( RES_TXTATR_REFMARK, n ) ))
continue;
@@ -1033,13 +1033,15 @@ const SwFmtRefMark* SwDoc::GetRefMark( const OUString& rName ) const
/// @return the RefMark per index - for Uno
const SwFmtRefMark* SwDoc::GetRefMark( sal_uInt16 nIndex ) const
{
- const SfxPoolItem* pItem;
const SwTxtRefMark* pTxtRef;
const SwFmtRefMark* pRet = 0;
sal_uInt32 nMaxItems = GetAttrPool().GetItemCount2( RES_TXTATR_REFMARK );
sal_uInt32 nCount = 0;
for( sal_uInt32 n = 0; n < nMaxItems; ++n )
+ {
+ const SfxPoolItem* pItem;
+
if( 0 != (pItem = GetAttrPool().GetItem2( RES_TXTATR_REFMARK, n )) &&
0 != (pTxtRef = static_cast<const SwFmtRefMark*>(pItem)->GetTxtRefMark()) &&
&pTxtRef->GetTxtNode().GetNodes() == &GetNodes() )
@@ -1051,6 +1053,7 @@ const SwFmtRefMark* SwDoc::GetRefMark( sal_uInt16 nIndex ) const
}
nCount++;
}
+ }
return pRet;
}
@@ -1059,12 +1062,14 @@ const SwFmtRefMark* SwDoc::GetRefMark( sal_uInt16 nIndex ) const
// OS 25.06.96: From now on we always return the reference count
sal_uInt16 SwDoc::GetRefMarks( std::vector<OUString>* pNames ) const
{
- const SfxPoolItem* pItem;
const SwTxtRefMark* pTxtRef;
const sal_uInt32 nMaxItems = GetAttrPool().GetItemCount2( RES_TXTATR_REFMARK );
sal_uInt16 nCount = 0;
for( sal_uInt32 n = 0; n < nMaxItems; ++n )
+ {
+ const SfxPoolItem* pItem;
+
if( 0 != (pItem = GetAttrPool().GetItem2( RES_TXTATR_REFMARK, n )) &&
0 != (pTxtRef = static_cast<const SwFmtRefMark*>(pItem)->GetTxtRefMark()) &&
&pTxtRef->GetTxtNode().GetNodes() == &GetNodes() )
@@ -1076,6 +1081,7 @@ sal_uInt16 SwDoc::GetRefMarks( std::vector<OUString>* pNames ) const
}
++nCount;
}
+ }
return nCount;
}
diff --git a/sw/source/core/doc/docbasic.cxx b/sw/source/core/doc/docbasic.cxx
index 4b2fdfe2d9f9..af1194d8c87e 100644
--- a/sw/source/core/doc/docbasic.cxx
+++ b/sw/source/core/doc/docbasic.cxx
@@ -143,15 +143,17 @@ sal_uInt16 SwDoc::CallEvent( sal_uInt16 nEvent, const SwCallMouseEvent& rCallEve
case EVENT_OBJECT_INETATTR:
if( bCheckPtr )
{
- const SfxPoolItem* pItem;
sal_uInt32 n, nMaxItems = GetAttrPool().GetItemCount2( RES_TXTATR_INETFMT );
for( n = 0; n < nMaxItems; ++n )
+ {
+ const SfxPoolItem* pItem;
if( 0 != (pItem = GetAttrPool().GetItem2( RES_TXTATR_INETFMT, n ) )
&& rCallEvent.PTR.pINetAttr == pItem )
{
bCheckPtr = false; // misuse as a flag
break;
}
+ }
}
if( !bCheckPtr )
pTbl = rCallEvent.PTR.pINetAttr->GetMacroTbl();
diff --git a/sw/source/core/doc/docchart.cxx b/sw/source/core/doc/docchart.cxx
index 02fdf9127b9c..669fa78b31dc 100644
--- a/sw/source/core/doc/docchart.cxx
+++ b/sw/source/core/doc/docchart.cxx
@@ -149,15 +149,17 @@ void SwDoc::SetTableName( SwFrmFmt& rTblFmt, const OUString &rNewName )
bool bNameFound = rNewName.isEmpty();
if( !bNameFound )
{
- const SwFrmFmt* pFmt;
const SwFrmFmts& rTbl = *GetTblFrmFmts();
for( size_t i = rTbl.size(); i; )
+ {
+ const SwFrmFmt* pFmt;
if( !( pFmt = rTbl[ --i ] )->IsDefault() &&
pFmt->GetName() == rNewName && IsUsed( *pFmt ) )
{
bNameFound = true;
break;
}
+ }
}
if( !bNameFound )
diff --git a/sw/source/core/doc/docdraw.cxx b/sw/source/core/doc/docdraw.cxx
index 5e49e9926dff..7c017eb57547 100644
--- a/sw/source/core/doc/docdraw.cxx
+++ b/sw/source/core/doc/docdraw.cxx
@@ -200,12 +200,13 @@ SwDrawContact* SwDoc::GroupSelection( SdrView& rDrawView )
SwDrawView::ReplaceMarkedDrawVirtObjs( rDrawView );
const SdrMarkList &rMrkList = rDrawView.GetMarkedObjectList();
- SwDrawFrmFmt *pFmt = 0L;
SdrObject *pObj = rMrkList.GetMark( 0 )->GetMarkedSdrObj();
bool bNoGroup = ( 0 == pObj->GetUpGroup() );
SwDrawContact* pNewContact = 0;
if( bNoGroup )
{
+ SwDrawFrmFmt *pFmt = 0L;
+
// Revoke anchor attribute.
SwDrawContact *pMyContact = static_cast<SwDrawContact*>(GetUserCall(pObj));
const SwFmtAnchor aAnch( pMyContact->GetFmt()->GetAnchor() );
diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx
index 5fe5b38e6e70..24b31c5fc018 100644
--- a/sw/source/core/doc/docedt.cxx
+++ b/sw/source/core/doc/docedt.cxx
@@ -127,7 +127,6 @@ void _SaveFlyInRange( const SwPaM& rPam, const SwNodeIndex& rInsPos,
for( sal_uInt16 n = 0; n < rFmts.size(); ++n )
{
- bool bInsPos = false;
pFmt = (SwFrmFmt*)rFmts[n];
pAnchor = &pFmt->GetAnchor();
const SwPosition* pAPos = pAnchor->GetCntntAnchor();
@@ -139,6 +138,8 @@ void _SaveFlyInRange( const SwPaM& rPam, const SwNodeIndex& rInsPos,
!( *pCntntIdx < rInsPos &&
rInsPos < pCntntIdx->GetNode().EndOfSectionIndex() )) )
{
+ bool bInsPos = false;
+
if( !bMoveAllFlys && rEndNdIdx == pAPos->nNode )
{
// Do not touch Anchor, if only a part of the EndNode
diff --git a/sw/source/core/doc/docfld.cxx b/sw/source/core/doc/docfld.cxx
index 04a6d5e7f34b..439c421ad743 100644
--- a/sw/source/core/doc/docfld.cxx
+++ b/sw/source/core/doc/docfld.cxx
@@ -455,10 +455,10 @@ void SwDoc::GetAllUsedDB( std::vector<OUString>& rDBNameList,
}
}
- const SfxPoolItem* pItem;
sal_uInt32 nMaxItems = GetAttrPool().GetItemCount2( RES_TXTATR_FIELD );
for (sal_uInt32 n = 0; n < nMaxItems; ++n)
{
+ const SfxPoolItem* pItem;
if( 0 == (pItem = GetAttrPool().GetItem2( RES_TXTATR_FIELD, n ) ))
continue;
diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx
index 8accb57c063e..9e7a32d96027 100644
--- a/sw/source/core/doc/doclay.cxx
+++ b/sw/source/core/doc/doclay.cxx
@@ -606,7 +606,7 @@ SwPosFlyFrms SwDoc::GetAllFlyFmts( const SwPaM* pCmpRange, bool bDrawAlso,
*/
static void lcl_CpyAttr( SfxItemSet &rNewSet, const SfxItemSet &rOldSet, sal_uInt16 nWhich )
{
- const SfxPoolItem *pOldItem = NULL, *pNewItem = NULL;
+ const SfxPoolItem *pOldItem = NULL;
rOldSet.GetItemState( nWhich, false, &pOldItem);
if (pOldItem != NULL)
@@ -616,7 +616,7 @@ static void lcl_CpyAttr( SfxItemSet &rNewSet, const SfxItemSet &rOldSet, sal_uIn
pOldItem = rOldSet.GetItem( nWhich, true);
if (pOldItem != NULL)
{
- pNewItem = rNewSet.GetItem( nWhich, true);
+ const SfxPoolItem *pNewItem = rNewSet.GetItem( nWhich, true);
if (pNewItem != NULL)
{
if (*pOldItem != *pNewItem)
@@ -1417,10 +1417,10 @@ void SwDoc::SetAllUniqueFlyNames()
{
if( RES_FLYFRMFMT == (pFlyFmt = (*GetSpzFrmFmts())[ --n ])->Which() )
{
- sal_Int32 *pNum = 0;
const OUString aNm = pFlyFmt->GetName();
if ( !aNm.isEmpty() )
{
+ sal_Int32 *pNum = 0;
sal_Int32 nLen = 0;
if ( aNm.startsWith(sGrfNm) )
{
@@ -1462,9 +1462,10 @@ void SwDoc::SetAllUniqueFlyNames()
}
SetContainsAtPageObjWithContentAnchor( bContainsAtPageObjWithContentAnchor );
- const SwNodeIndex* pIdx;
-
for( n = aArr.size(); n; )
+ {
+ const SwNodeIndex* pIdx;
+
if( 0 != ( pIdx = ( pFlyFmt = aArr[ --n ])->GetCntnt().GetCntntIdx() )
&& pIdx->GetNode().GetNodes().IsDocNodes() )
{
@@ -1487,6 +1488,7 @@ void SwDoc::SetAllUniqueFlyNames()
}
pFlyFmt->SetName( sNm + OUString::number( nNum ));
}
+ }
aArr.clear();
if( !GetFtnIdxs().empty() )
diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx
index ebd6f46d5417..cc1efe0ac6fd 100644
--- a/sw/source/core/doc/docnum.cxx
+++ b/sw/source/core/doc/docnum.cxx
@@ -1933,10 +1933,11 @@ bool SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, bool bIsOutlMv )
// All, that are in the to-be-deleted Node, need to be
// moved to the next Node
- SwPosition* pPos;
for( sal_uInt16 n = 0; n < getIDocumentRedlineAccess().GetRedlineTbl().size(); ++n )
{
SwRangeRedline* pTmp = getIDocumentRedlineAccess().GetRedlineTbl()[ n ];
+
+ SwPosition* pPos;
if( ( pPos = &pTmp->GetBound(true))->nNode == aIdx )
{
pPos->nNode++;
diff --git a/sw/source/core/doc/fmtcol.cxx b/sw/source/core/doc/fmtcol.cxx
index a27a8092ff60..a36f5f17444b 100644
--- a/sw/source/core/doc/fmtcol.cxx
+++ b/sw/source/core/doc/fmtcol.cxx
@@ -208,9 +208,9 @@ void SwTxtFmtColl::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
if( pNewLRSpace && SfxItemState::SET == GetItemState( RES_LR_SPACE, false,
(const SfxPoolItem**)&pOldLRSpace ))
{
- bool bChg = false;
if( pOldLRSpace != pNewLRSpace ) // Avoid recursion (SetAttr!)
{
+ bool bChg = false;
SvxLRSpaceItem aNew( *pOldLRSpace );
// We had a relative value -> recalculate
if( 100 != aNew.GetPropLeft() )
diff --git a/sw/source/core/doc/gctable.cxx b/sw/source/core/doc/gctable.cxx
index 51acdd3e11f5..291a003586f9 100644
--- a/sw/source/core/doc/gctable.cxx
+++ b/sw/source/core/doc/gctable.cxx
@@ -180,8 +180,9 @@ void sw_GC_Line_Border( const SwTableLine* pLine, _SwGCLineBorder* pGCPara )
lcl_GCBorder_GetLastBox_B( pBox, &aBoxes );
}
- SwTableBox* pBox;
for( sal_uInt16 i = aBoxes.size(); i; )
+ {
+ SwTableBox* pBox;
if( SfxItemState::SET == (pBox = aBoxes[ --i ])->GetFrmFmt()->
GetItemState( RES_BOX, true, &pItem ) &&
0 != ( pBrd = static_cast<const SvxBoxItem*>(pItem)->GetRight() ) )
@@ -199,6 +200,7 @@ void sw_GC_Line_Border( const SwTableLine* pLine, _SwGCLineBorder* pGCPara )
pBox->ClaimFrmFmt()->SetFmtAttr( aBox );
}
}
+ }
aBoxes.clear();
}
diff --git a/sw/source/core/doc/number.cxx b/sw/source/core/doc/number.cxx
index c48ffd7f7486..c205c336a4ff 100644
--- a/sw/source/core/doc/number.cxx
+++ b/sw/source/core/doc/number.cxx
@@ -340,10 +340,9 @@ void SwNumFmt::UpdateNumNodes( SwDoc* pDoc )
{
bool bDocIsModified = pDoc->getIDocumentState().IsModified();
bool bFnd = false;
- const SwNumRule* pRule;
for( sal_uInt16 n = pDoc->GetNumRuleTbl().size(); !bFnd && n; )
{
- pRule = pDoc->GetNumRuleTbl()[ --n ];
+ const SwNumRule* pRule = pDoc->GetNumRuleTbl()[ --n ];
for( sal_uInt8 i = 0; i < MAXLEVEL; ++i )
if( pRule->GetNumFmt( i ) == this )
{
@@ -537,8 +536,9 @@ SwNumRule::~SwNumRule()
void SwNumRule::CheckCharFmts( SwDoc* pDoc )
{
- SwCharFmt* pFmt;
for( sal_uInt8 n = 0; n < MAXLEVEL; ++n )
+ {
+ SwCharFmt* pFmt;
if( maFmts[ n ] && 0 != ( pFmt = maFmts[ n ]->GetCharFmt() ) &&
pFmt->GetDoc() != pDoc )
{
@@ -548,6 +548,7 @@ void SwNumRule::CheckCharFmts( SwDoc* pDoc )
delete maFmts[ n ];
maFmts[ n ] = pNew;
}
+ }
}
SwNumRule& SwNumRule::operator=( const SwNumRule& rNumRule )
diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx
index fc34d7db4fe8..1e8caaaa546e 100644
--- a/sw/source/core/doc/tblrwcl.cxx
+++ b/sw/source/core/doc/tblrwcl.cxx
@@ -703,11 +703,12 @@ void _DeleteBox( SwTable& rTbl, SwTableBox* pBox, SwUndo* pUndo,
// Special treatment for the border:
if( bCorrBorder && 1 < rTblBoxes.size() )
{
- bool bChgd = false;
const SvxBoxItem& rBoxItem = pBox->GetFrmFmt()->GetBox();
if( rBoxItem.GetLeft() || rBoxItem.GetRight() )
{
+ bool bChgd = false;
+
// JP 02.04.97: 1st part for Bug 36271
// First the left/right edges
if( nDelPos + 1 < (sal_uInt16)rTblBoxes.size() )
@@ -900,7 +901,6 @@ lcl_SaveUpperLowerBorder( SwTable& rTbl, const SwTableBox& rBox,
size_t *const pCurPos = 0 )
{
//JP 16.04.97: 2. part for Bug 36271
- bool bChgd = false;
const SwTableLine* pLine = rBox.GetUpper();
const SwTableBoxes& rTblBoxes = pLine->GetTabBoxes();
const SwTableBox* pUpperBox = &rBox;
@@ -911,7 +911,7 @@ lcl_SaveUpperLowerBorder( SwTable& rTbl, const SwTableBox& rBox,
// then the top/bottom edges
if( rBoxItem.GetTop() || rBoxItem.GetBottom() )
{
- bChgd = false;
+ bool bChgd = false;
const SwTableLines* pTblLns;
if( pUpperBox )
pTblLns = &pUpperBox->GetTabLines();
diff --git a/sw/source/core/docnode/ndsect.cxx b/sw/source/core/docnode/ndsect.cxx
index 27af382eccda..1a639d791e5c 100644
--- a/sw/source/core/docnode/ndsect.cxx
+++ b/sw/source/core/docnode/ndsect.cxx
@@ -1077,11 +1077,11 @@ void SwSectionNode::MakeFrms(const SwNodeIndex & rIdx )
else
{
SwNode2Layout aNode2Layout( *this, rIdx.GetIndex() );
- SwFrm *pFrm, *pNew;
+ SwFrm *pFrm;
while( 0 != (pFrm = aNode2Layout.NextFrm()) )
{
OSL_ENSURE( pFrm->IsSctFrm(), "Depend of Section not a Section." );
- pNew = rIdx.GetNode().GetCntntNode()->MakeFrm( pFrm );
+ SwFrm *pNew = rIdx.GetNode().GetCntntNode()->MakeFrm( pFrm );
SwSectionNode* pS = rIdx.GetNode().FindSectionNode();
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index c779ceaa5816..f7b88211e180 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -1005,7 +1005,6 @@ SwTableNode* SwNodes::TextToTable( const SwNodeRange& rRange, sal_Unicode cCh,
SwDoc* pDoc = GetDoc();
std::vector<sal_uInt16> aPosArr;
SwTable * pTable = &pTblNd->GetTable();
- SwTableLine* pLine;
SwTableBox* pBox;
sal_uInt16 nBoxes, nLines, nMaxBoxes = 0;
@@ -1049,7 +1048,7 @@ SwTableNode* SwNodes::TextToTable( const SwNodeRange& rRange, sal_Unicode cCh,
// Set the TableNode as StartNode for all TextNodes in the Table
pTxtNd->pStartOfSection = pTblNd;
- pLine = new SwTableLine( pLineFmt, 1, 0 );
+ SwTableLine* pLine = new SwTableLine( pLineFmt, 1, 0 );
pTable->GetTabLines().insert( pTable->GetTabLines().begin() + nLines, pLine );
SwStartNode* pSttNd;
@@ -1348,7 +1347,6 @@ SwTableNode* SwNodes::TextToTable( const SwNodes::TableRanges_t & rTableNodes,
SwDoc* pDoc = GetDoc();
SwTable * pTable = &pTblNd->GetTable();
- SwTableLine* pLine;
SwTableBox* pBox;
sal_uInt16 nBoxes, nLines, nMaxBoxes = 0;
@@ -1369,7 +1367,7 @@ SwTableNode* SwNodes::TextToTable( const SwNodes::TableRanges_t & rTableNodes,
aRowIter != rTableNodes.end();
++aRowIter, nLines++, nBoxes = 0 )
{
- pLine = new SwTableLine( pLineFmt, 1, 0 );
+ SwTableLine* pLine = new SwTableLine( pLineFmt, 1, 0 );
pTable->GetTabLines().insert( pTable->GetTabLines().begin() + nLines, pLine );
std::vector< SwNodeRange >::const_iterator aCellIter = aRowIter->begin();
@@ -2337,7 +2335,7 @@ void SwTableNode::MakeFrms(const SwNodeIndex & rIdx )
if( !GetTable().GetFrmFmt()->GetDepends()) // Do we actually have Frame?
return;
- SwFrm *pFrm, *pNew;
+ SwFrm *pFrm;
SwCntntNode * pNode = rIdx.GetNode().GetCntntNode();
OSL_ENSURE( pNode, "No ContentNode or CopyNode and new Node is identical");
@@ -2348,7 +2346,7 @@ void SwTableNode::MakeFrms(const SwNodeIndex & rIdx )
while( 0 != (pFrm = aNode2Layout.NextFrm()) )
{
- pNew = pNode->MakeFrm( pFrm );
+ SwFrm *pNew = pNode->MakeFrm( pFrm );
// Will the Node receive Frames before or after?
if ( bBefore )
// The new one preceds me
diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx
index 14af4cedff54..164472376193 100644
--- a/sw/source/core/docnode/node.cxx
+++ b/sw/source/core/docnode/node.cxx
@@ -661,9 +661,10 @@ const SwPageDesc* SwNode::FindPageDesc( bool bCalcLay,
{
SwFindNearestNode aInfo( *pNd );
// Over all Nodes of all PageDescs
- const SfxPoolItem* pItem;
sal_uInt32 i, nMaxItems = pDoc->GetAttrPool().GetItemCount2( RES_PAGEDESC );
for( i = 0; i < nMaxItems; ++i )
+ {
+ const SfxPoolItem* pItem;
if( 0 != (pItem = pDoc->GetAttrPool().GetItem2( RES_PAGEDESC, i ) ) &&
static_cast<const SwFmtPageDesc*>(pItem)->GetDefinedIn() )
{
@@ -673,6 +674,7 @@ const SwPageDesc* SwNode::FindPageDesc( bool bCalcLay,
else if( pMod->ISA( SwFmt ))
static_cast<const SwFmt*>(pMod)->GetInfo( aInfo );
}
+ }
if( 0 != ( pNd = aInfo.GetFoundNode() ))
{
@@ -1194,7 +1196,7 @@ void SwCntntNode::MakeFrms( SwCntntNode& rNode )
if( !GetDepends() || &rNode == this ) // Do we actually have Frames?
return;
- SwFrm *pFrm, *pNew;
+ SwFrm *pFrm;
SwLayoutFrm *pUpper;
// Create Frames for Nodes which come after the Table?
OSL_ENSURE( FindTableNode() == rNode.FindTableNode(), "Table confusion" );
@@ -1203,7 +1205,7 @@ void SwCntntNode::MakeFrms( SwCntntNode& rNode )
while( 0 != (pUpper = aNode2Layout.UpperFrm( pFrm, rNode )) )
{
- pNew = rNode.MakeFrm( pUpper );
+ SwFrm *pNew = rNode.MakeFrm( pUpper );
pNew->Paste( pUpper, pFrm );
// #i27138#
// notify accessibility paragraphs objects about changed