summaryrefslogtreecommitdiff
path: root/sw/source/filter/ww8
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2015-01-16 13:50:00 +0000
committerNoel Grandin <noelgrandin@gmail.com>2015-01-19 06:17:58 +0000
commita1fb4ac1991a8da2e527b64a0a01a88a8f2959e3 (patch)
tree3afabf8fb5bb88d77f72f095e32ff23d38d3f42c /sw/source/filter/ww8
parentd1aecd4353bd6ac3961a30df67de78f4b8f0a66b (diff)
fdo#39440 sw: reduce scope of local variables
This addresses some cppcheck warnings. Change-Id: I7cbc1908d0e3c84f5864db34984d0740db891aef Reviewed-on: https://gerrit.libreoffice.org/13962 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'sw/source/filter/ww8')
-rw-r--r--sw/source/filter/ww8/rtfexport.cxx8
-rw-r--r--sw/source/filter/ww8/ww8atr.cxx8
-rw-r--r--sw/source/filter/ww8/ww8par2.cxx6
-rw-r--r--sw/source/filter/ww8/ww8par3.cxx3
4 files changed, 12 insertions, 13 deletions
diff --git a/sw/source/filter/ww8/rtfexport.cxx b/sw/source/filter/ww8/rtfexport.cxx
index dd9ec5e85df5..e39b18e01266 100644
--- a/sw/source/filter/ww8/rtfexport.cxx
+++ b/sw/source/filter/ww8/rtfexport.cxx
@@ -186,14 +186,16 @@ static bool IsExportNumRule(const SwNumRule& rRule, sal_uInt8* pEnd = 0)
;
++nEnd;
- const SwNumFmt* pNFmt;
sal_uInt8 nLvl;
for (nLvl = 0; nLvl < nEnd; ++nLvl)
- if (SVX_NUM_NUMBER_NONE != (pNFmt = &rRule.Get(nLvl))
- ->GetNumberingType() || !pNFmt->GetPrefix().isEmpty() ||
+ {
+ const SwNumFmt* pNFmt = &rRule.Get(nLvl);
+ if (SVX_NUM_NUMBER_NONE != pNFmt->GetNumberingType() ||
+ !pNFmt->GetPrefix().isEmpty() ||
(!pNFmt->GetSuffix().isEmpty() && pNFmt->GetSuffix() != "."))
break;
+ }
if (pEnd)
*pEnd = nEnd;
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index be73977dbffc..3c5cb1a34640 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -893,15 +893,14 @@ void MSWordExportBase::OutputFormat( const SwFmt& rFmt, bool bPapFmt, bool bChpF
bool MSWordExportBase::HasRefToObject( sal_uInt16 nTyp, const OUString* pName, sal_uInt16 nSeqNo )
{
- const SwTxtNode* pNd;
SwFieldType* pType = pDoc->getIDocumentFieldsAccess().GetSysFldType( RES_GETREFFLD );
SwIterator<SwFmtFld, SwFieldType> aFmtFlds( *pType );
for ( SwFmtFld* pFmtFld = aFmtFlds.First(); pFmtFld; pFmtFld = aFmtFlds.Next() )
{
+ const SwTxtNode* pNd = pFmtFld->GetTxtFld()->GetpTxtNode();
if ( pFmtFld->GetTxtFld() && nTyp == pFmtFld->GetField()->GetSubType() &&
- 0 != ( pNd = pFmtFld->GetTxtFld()->GetpTxtNode() ) &&
- pNd->GetNodes().IsDocNodes() )
+ 0 != pNd && pNd->GetNodes().IsDocNodes() )
{
const SwGetRefField& rRFld = *static_cast< SwGetRefField* >( pFmtFld->GetField() );
switch ( nTyp )
@@ -2032,12 +2031,13 @@ static int lcl_CheckForm( const SwForm& rForm, sal_uInt8 nLvl, OUString& rText )
// #i21237#
SwFormTokens aPattern = rForm.GetPattern(nLvl);
SwFormTokens::iterator aIt = aPattern.begin();
- bool bPgNumFnd = false;
FormTokenType eTType;
// #i61362#
if (! aPattern.empty())
{
+ bool bPgNumFnd = false;
+
// #i21237#
while( ++aIt != aPattern.end() && !bPgNumFnd )
{
diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index c66c92e69391..b42eb8f67b4a 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -1296,13 +1296,11 @@ void WW8TabBandDesc::ProcessSprmTDxaCol(const sal_uInt8* pParamsTDxaCol)
sal_uInt8 nitcFirst= pParamsTDxaCol[0]; // first col to be changed
sal_uInt8 nitcLim = pParamsTDxaCol[1]; // (last col to be changed)+1
short nDxaCol = (sal_Int16)SVBT16ToShort( pParamsTDxaCol + 2 );
- short nOrgWidth;
- short nDelta;
for( int i = nitcFirst; (i < nitcLim) && (i < nWwCols); i++ )
{
- nOrgWidth = nCenter[i+1] - nCenter[i];
- nDelta = nDxaCol - nOrgWidth;
+ const short nOrgWidth = nCenter[i+1] - nCenter[i];
+ const short nDelta = nDxaCol - nOrgWidth;
for( int j = i+1; j <= nWwCols; j++ )
{
nCenter[j] = nCenter[j] + nDelta;
diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx
index 19a6f004adf8..b5918c06f9f7 100644
--- a/sw/source/filter/ww8/ww8par3.cxx
+++ b/sw/source/filter/ww8/ww8par3.cxx
@@ -987,10 +987,9 @@ void WW8ListManager::AdjustLVL( sal_uInt8 nLevel, SwNumRule& rNumRule,
{
nIdenticalItemSetLevel = nMaxLevel;
SfxItemIter aIter( *pThisLevelItemSet );
- SfxItemSet* pLowerLevelItemSet;
for (sal_uInt8 nLowerLevel = 0; nLowerLevel < nLevel; ++nLowerLevel)
{
- pLowerLevelItemSet = rListItemSet[ nLowerLevel ];
+ SfxItemSet* pLowerLevelItemSet = rListItemSet[ nLowerLevel ];
if( pLowerLevelItemSet
&& (pLowerLevelItemSet->Count() == pThisLevelItemSet->Count()) )
{