summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2015-10-14 02:51:05 +0200
committerNoel Grandin <noelgrandin@gmail.com>2015-10-15 06:49:23 +0000
commitb4b7703e4335460cf48bfd6440f116359994c8ff (patch)
tree66b6ab43d6fb13d037160d7384d1a7a93d92940b /sw
parent90d82f73b89d8a0b0b13d224dbd1a741a10a7fd9 (diff)
cppcheck:variableScope
Change-Id: I9b671637fbe0f32e695d22b74bfb40a39a9fe884 Reviewed-on: https://gerrit.libreoffice.org/19364 Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/doc/doccomp.cxx2
-rw-r--r--sw/source/core/doc/docedt.cxx3
-rw-r--r--sw/source/core/layout/calcmove.cxx3
-rw-r--r--sw/source/core/layout/fly.cxx2
-rw-r--r--sw/source/core/layout/frmtool.cxx3
-rw-r--r--sw/source/core/table/swnewtable.cxx3
-rw-r--r--sw/source/core/text/txtdrop.cxx2
-rw-r--r--sw/source/core/txtnode/thints.cxx4
-rw-r--r--sw/source/filter/html/htmlatr.cxx2
-rw-r--r--sw/source/filter/html/swhtml.cxx3
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx2
-rw-r--r--sw/source/ui/index/cntex.cxx86
-rw-r--r--sw/source/uibase/app/docst.cxx2
-rw-r--r--sw/source/uibase/sidebar/StylePresetsPanel.cxx3
14 files changed, 59 insertions, 61 deletions
diff --git a/sw/source/core/doc/doccomp.cxx b/sw/source/core/doc/doccomp.cxx
index db6e38184176..390f80a58e63 100644
--- a/sw/source/core/doc/doccomp.cxx
+++ b/sw/source/core/doc/doccomp.cxx
@@ -1699,10 +1699,10 @@ void CompareData::SetRedlinesToDoc( bool bUseDocInfo )
// combine consecutive
if( pTmp->GetNext() != pInsRing )
{
- const SwContentNode* pCNd;
do {
SwPosition& rSttEnd = *pTmp->End(),
& rEndStt = *(pTmp->GetNext())->Start();
+ const SwContentNode* pCNd;
if( rSttEnd == rEndStt ||
(!rEndStt.nContent.GetIndex() &&
rEndStt.nNode.GetIndex() - 1 == rSttEnd.nNode.GetIndex() &&
diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx
index c492c2ae85e0..111a5223a033 100644
--- a/sw/source/core/doc/docedt.cxx
+++ b/sw/source/core/doc/docedt.cxx
@@ -131,13 +131,12 @@ void _SaveFlyInRange( const SwPaM& rPam, const SwNodeIndex& rInsPos,
pPos->nContent == rEndNdIdx.GetNode().GetContentNode()->Len() ))
? 0 : 1;
- const SwNodeIndex* pContentIdx;
-
for( SwFrameFormats::size_type n = 0; n < rFormats.size(); ++n )
{
pFormat = rFormats[n];
pAnchor = &pFormat->GetAnchor();
const SwPosition* pAPos = pAnchor->GetContentAnchor();
+ const SwNodeIndex* pContentIdx;
if (pAPos &&
((FLY_AT_PARA == pAnchor->GetAnchorId()) ||
(FLY_AT_CHAR == pAnchor->GetAnchorId())) &&
diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx
index 1ceaf5594a9d..78c96d14e590 100644
--- a/sw/source/core/layout/calcmove.cxx
+++ b/sw/source/core/layout/calcmove.cxx
@@ -1093,7 +1093,6 @@ void SwContentFrm::MakeAll(vcl::RenderContext* /*pRenderContext*/)
// this flag is set. If it turns out that it
// didn't keep it's promise, we can act in a
// controlled fashion.
- bool bMoveable;
const bool bFly = IsInFly();
const bool bTab = IsInTab();
const bool bFootnote = IsInFootnote();
@@ -1197,6 +1196,8 @@ void SwContentFrm::MakeAll(vcl::RenderContext* /*pRenderContext*/)
SWRECTFN( this )
+ bool bMoveable;
+
while ( !mbValidPos || !mbValidSize || !mbValidPrtArea )
{
// - loop prevention
diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index 87c275d7fed4..2d854d6f1917 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -1496,10 +1496,10 @@ void CalcContent( SwLayoutFrm *pLay,
pTmpPrevFlowFrm->IsKeepFwdMoveAllowed();
// format floating screen objects anchored to the frame.
- bool bRestartLayoutProcess = false;
if ( !bPrevInvalid && pFrm->GetDrawObjs() && pLay->IsAnLower( pFrm ) )
{
bool bAgain = false;
+ bool bRestartLayoutProcess = false;
SwPageFrm* pPageFrm = pFrm->FindPageFrm();
size_t nCnt = pFrm->GetDrawObjs()->size();
size_t i = 0;
diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx
index bf38170751c8..073cdf67121e 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -1248,8 +1248,6 @@ void _InsertCnt( SwLayoutFrm *pLay, SwDoc *pDoc,
SwPageFrm *pPage = pLay->FindPageFrm();
const SwFrameFormats *pTable = pDoc->GetSpzFrameFormats();
SwFrm *pFrm = 0;
- bool bBreakAfter = false;
-
SwActualSection *pActualSection = 0;
SwLayHelper *pPageMaker;
@@ -1260,6 +1258,7 @@ void _InsertCnt( SwLayoutFrm *pLay, SwDoc *pDoc,
{
// Attention: the SwLayHelper class uses references to the content-,
// page-, layout-frame etc. and may change them!
+ bool bBreakAfter = false;
pPageMaker = new SwLayHelper( pDoc, pFrm, pPrv, pPage, pLay,
pActualSection, bBreakAfter, nIndex, 0 == nEndIndex );
if( bStartPercent )
diff --git a/sw/source/core/table/swnewtable.cxx b/sw/source/core/table/swnewtable.cxx
index 2f7a9f8552c6..924546c61bdc 100644
--- a/sw/source/core/table/swnewtable.cxx
+++ b/sw/source/core/table/swnewtable.cxx
@@ -381,14 +381,13 @@ SwBoxSelection* SwTable::CollectBoxSelection( const SwPaM& rPam ) const
SwTableLine* pLine = aLines[nRow];
OSL_ENSURE( pLine, "Missing table line" );
SwSelBoxes *pBoxes = new SwSelBoxes();
- long nLeft = 0;
long nRight = 0;
const size_t nCount = pLine->GetTabBoxes().size();
for( size_t nCurrBox = 0; nCurrBox < nCount; ++nCurrBox )
{
SwTableBox* pBox = pLine->GetTabBoxes()[nCurrBox];
OSL_ENSURE( pBox, "Missing table box" );
- nLeft = nRight;
+ long nLeft = nRight;
nRight += pBox->GetFrameFormat()->GetFrmSize().GetWidth();
long nRowSpan = pBox->getRowSpan();
if( nRight <= nMin )
diff --git a/sw/source/core/text/txtdrop.cxx b/sw/source/core/text/txtdrop.cxx
index 5fa21bf5f45b..553719acb6dc 100644
--- a/sw/source/core/text/txtdrop.cxx
+++ b/sw/source/core/text/txtdrop.cxx
@@ -678,7 +678,6 @@ void SwDropCapCache::CalcFontSize( SwDropPortion* pDrop, SwTextFormatInfo &rInf
sal_Int32 nIdx = rInf.GetIdx();
OUString aStr(rInf.GetText().copy(nIdx, pCurrPart->GetLen()));
- long nAscent = 0;
long nDescent = 0;
long nFactor = -1;
@@ -707,6 +706,7 @@ void SwDropCapCache::CalcFontSize( SwDropPortion* pDrop, SwTextFormatInfo &rInf
nTmpIdx = nIndex;
long nWishedHeight = pDrop->GetDropHeight();
+ long nAscent = 0;
// find out biggest font size for initial scaling factor
long nMaxFontHeight = 1;
diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx
index 7e5098fa8209..5df015ffabd8 100644
--- a/sw/source/core/txtnode/thints.cxx
+++ b/sw/source/core/txtnode/thints.cxx
@@ -3111,10 +3111,10 @@ bool SwpHints::TryInsertHint(
{
// search for a reference with the same name
SwTextAttr* pTmpHt;
- sal_Int32 *pTmpHtEnd;
- sal_Int32 *pTmpHintEnd;
for( size_t n = 0, nEnd = Count(); n < nEnd; ++n )
{
+ sal_Int32 *pTmpHtEnd;
+ sal_Int32 *pTmpHintEnd;
if (RES_TXTATR_REFMARK == (pTmpHt = Get(n))->Which() &&
pHint->GetAttr() == pTmpHt->GetAttr() &&
0 != ( pTmpHtEnd = pTmpHt->GetEnd() ) &&
diff --git a/sw/source/filter/html/htmlatr.cxx b/sw/source/filter/html/htmlatr.cxx
index 375e914eb6fd..055255f30eda 100644
--- a/sw/source/filter/html/htmlatr.cxx
+++ b/sw/source/filter/html/htmlatr.cxx
@@ -254,7 +254,6 @@ SwHTMLFormatInfo::SwHTMLFormatInfo( const SwFormat *pF, SwDoc *pDoc, SwDoc *pTem
pFormat->Which() == RES_CONDTXTFMTCOLL;
const SwFormat *pReferenceFormat = 0; // Vergleichs-Format
- bool bSetDefaults = true, bClearSame = true;
if( nDeep != 0 )
{
// Es ist eine HTML-Tag-Vorlage oder die Vorlage ist von einer
@@ -307,6 +306,7 @@ SwHTMLFormatInfo::SwHTMLFormatInfo( const SwFormat *pF, SwDoc *pDoc, SwDoc *pTem
pItemSet->Set( pFormat->GetAttrSet() );
+ bool bSetDefaults = true, bClearSame = true;
if( pReferenceFormat )
SwHTMLWriter::SubtractItemSet( *pItemSet, pReferenceFormat->GetAttrSet(),
bSetDefaults, bClearSame );
diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx
index 6312eab62776..a964ca1dc961 100644
--- a/sw/source/filter/html/swhtml.cxx
+++ b/sw/source/filter/html/swhtml.cxx
@@ -3039,7 +3039,7 @@ bool SwHTMLParser::EndAttr( _HTMLAttr* pAttr, _HTMLAttr **ppDepAttr,
bool bInsert;
sal_uInt16 nScriptItem = 0;
- bool bScript = false, bFont = false;
+ bool bScript = false;
// ein Bereich ??
if( !bChkEmpty || (RES_PARATR_BEGIN <= nWhich && bMoveBack) ||
RES_PAGEDESC == nWhich || RES_BREAK == nWhich ||
@@ -3050,6 +3050,7 @@ bool SwHTMLParser::EndAttr( _HTMLAttr* pAttr, _HTMLAttr **ppDepAttr,
// We do some optimization for script depenedent attributes here.
if( *pEndIdx == pAttr->GetSttPara() )
{
+ bool bFont = false;
lcl_swhtml_getItemInfo( *pAttr, bScript, bFont, nScriptItem );
}
}
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 8aba8533f343..c961698a0b18 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -3198,7 +3198,6 @@ void DocxAttributeOutput::TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t
long nPageSize = 0;
const char* widthType = "dxa";
- bool bRelBoxSize = false;
// If actual width of table is relative it should export is as "pct".`
const SwTable *pTable = pTableTextNodeInfoInner->getTable();
@@ -3227,6 +3226,7 @@ void DocxAttributeOutput::TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t
}
else
{
+ bool bRelBoxSize = false;
// Create the SwWriteTable instance to use col spans (and maybe other infos)
GetTablePageSize( pTableTextNodeInfoInner.get(), nPageSize, bRelBoxSize );
if(nPageSize == 0)
diff --git a/sw/source/ui/index/cntex.cxx b/sw/source/ui/index/cntex.cxx
index f94e1e185053..886798756993 100644
--- a/sw/source/ui/index/cntex.cxx
+++ b/sw/source/ui/index/cntex.cxx
@@ -147,58 +147,58 @@ void SwMultiTOXTabDialog::CreateOrUpdateExample(
if(!pExampleFrame || !pExampleFrame->IsInitialized())
return;
- const char* IndexServiceNames[] =
- {
- "com.sun.star.text.DocumentIndex",
- "com.sun.star.text.UserIndex",
- "com.sun.star.text.ContentIndex",
- "com.sun.star.text.IllustrationsIndex",
- "com.sun.star.text.ObjectIndex",
- "com.sun.star.text.TableIndex",
- "com.sun.star.text.Bibliography"
- };
-
try
{
- OSL_ENSURE(pxIndexSectionsArr[nTOXIndex] &&
+ static const char* IndexServiceNames[] =
+ {
+ "com.sun.star.text.DocumentIndex",
+ "com.sun.star.text.UserIndex",
+ "com.sun.star.text.ContentIndex",
+ "com.sun.star.text.IllustrationsIndex",
+ "com.sun.star.text.ObjectIndex",
+ "com.sun.star.text.TableIndex",
+ "com.sun.star.text.Bibliography"
+ };
+
+ OSL_ENSURE(pxIndexSectionsArr[nTOXIndex] &&
pxIndexSectionsArr[nTOXIndex]->xContainerSection.is(),
"Section not created");
uno::Reference< frame::XModel > & xModel = pExampleFrame->GetModel();
- bool bInitialCreate = true;
- if(!pxIndexSectionsArr[nTOXIndex]->xDocumentIndex.is())
- {
- bInitialCreate = true;
- if(!pxIndexSectionsArr[nTOXIndex]->xContainerSection.is())
- throw uno::RuntimeException();
- uno::Reference< text::XTextRange > xAnchor = pxIndexSectionsArr[nTOXIndex]->xContainerSection->getAnchor();
- xAnchor = xAnchor->getStart();
- uno::Reference< text::XTextCursor > xCrsr = xAnchor->getText()->createTextCursorByRange(xAnchor);
+ bool bInitialCreate = true;
+ if(!pxIndexSectionsArr[nTOXIndex]->xDocumentIndex.is())
+ {
+ bInitialCreate = true;
+ if(!pxIndexSectionsArr[nTOXIndex]->xContainerSection.is())
+ throw uno::RuntimeException();
+ uno::Reference< text::XTextRange > xAnchor = pxIndexSectionsArr[nTOXIndex]->xContainerSection->getAnchor();
+ xAnchor = xAnchor->getStart();
+ uno::Reference< text::XTextCursor > xCrsr = xAnchor->getText()->createTextCursorByRange(xAnchor);
- uno::Reference< lang::XMultiServiceFactory > xFact(xModel, uno::UNO_QUERY);
+ uno::Reference< lang::XMultiServiceFactory > xFact(xModel, uno::UNO_QUERY);
- OUString sIndexTypeName(OUString::createFromAscii( IndexServiceNames[
+ OUString sIndexTypeName(OUString::createFromAscii( IndexServiceNames[
nTOXIndex <= TOX_AUTHORITIES ? nTOXIndex : TOX_USER] ));
- pxIndexSectionsArr[nTOXIndex]->xDocumentIndex = uno::Reference< text::XDocumentIndex > (xFact->createInstance(
+ pxIndexSectionsArr[nTOXIndex]->xDocumentIndex = uno::Reference< text::XDocumentIndex > (xFact->createInstance(
sIndexTypeName), uno::UNO_QUERY);
- uno::Reference< text::XTextContent > xContent(pxIndexSectionsArr[nTOXIndex]->xDocumentIndex, uno::UNO_QUERY);
- uno::Reference< text::XTextRange > xRg(xCrsr, uno::UNO_QUERY);
- xCrsr->getText()->insertTextContent(xRg, xContent, sal_False);
- }
- for(sal_uInt16 i = 0 ; i <= TOX_AUTHORITIES; i++)
- {
+ uno::Reference< text::XTextContent > xContent(pxIndexSectionsArr[nTOXIndex]->xDocumentIndex, uno::UNO_QUERY);
+ uno::Reference< text::XTextRange > xRg(xCrsr, uno::UNO_QUERY);
+ xCrsr->getText()->insertTextContent(xRg, xContent, sal_False);
+ }
+ for(sal_uInt16 i = 0 ; i <= TOX_AUTHORITIES; i++)
+ {
uno::Reference< beans::XPropertySet > xSectPr(pxIndexSectionsArr[i]->xContainerSection, uno::UNO_QUERY);
if(xSectPr.is())
{
xSectPr->setPropertyValue(UNO_NAME_IS_VISIBLE, makeAny(i == nTOXIndex));
}
- }
- // set properties
- uno::Reference< beans::XPropertySet > xIdxProps(pxIndexSectionsArr[nTOXIndex]->xDocumentIndex, uno::UNO_QUERY);
- uno::Reference< beans::XPropertySetInfo > xInfo = xIdxProps->getPropertySetInfo();
- SwTOXDescription& rDesc = GetTOXDescription(eCurrentTOXType);
- sal_uInt16 nIdxOptions = rDesc.GetIndexOptions();
- if(bInitialCreate || !nPage || nPage == TOX_PAGE_SELECT)
- {
+ }
+ // set properties
+ uno::Reference< beans::XPropertySet > xIdxProps(pxIndexSectionsArr[nTOXIndex]->xDocumentIndex, uno::UNO_QUERY);
+ uno::Reference< beans::XPropertySetInfo > xInfo = xIdxProps->getPropertySetInfo();
+ SwTOXDescription& rDesc = GetTOXDescription(eCurrentTOXType);
+ sal_uInt16 nIdxOptions = rDesc.GetIndexOptions();
+ if(bInitialCreate || !nPage || nPage == TOX_PAGE_SELECT)
+ {
//title
if(rDesc.GetTitle())
lcl_SetProp(xInfo, xIdxProps, UNO_NAME_TITLE, *rDesc.GetTitle());
@@ -270,10 +270,10 @@ void SwMultiTOXTabDialog::CreateOrUpdateExample(
lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_STAR_CALC, 0 != (nsSwTOOElements::TOO_CALC &nOLEOptions ));
lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_STAR_DRAW, 0 != (nsSwTOOElements::TOO_DRAW_IMPRESS&nOLEOptions));
lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_OTHER_EMBEDDED_OBJECTS, 0 != (nsSwTOOElements::TOO_OTHER & nOLEOptions));
- }
- const SwForm* pForm = GetForm(eCurrentTOXType);
- if(bInitialCreate || !nPage || nPage == TOX_PAGE_ENTRY)
- {
+ }
+ const SwForm* pForm = GetForm(eCurrentTOXType);
+ if(bInitialCreate || !nPage || nPage == TOX_PAGE_ENTRY)
+ {
lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_IS_COMMA_SEPARATED, pForm->IsCommaSeparated());
lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_USE_ALPHABETICAL_SEPARATORS, 0 != (nIdxOptions&nsSwTOIOptions::TOI_ALPHA_DELIMITTER));
const bool bUseCurrent = nCurrentLevel < pForm->GetFormMax();
@@ -358,7 +358,7 @@ void SwMultiTOXTabDialog::CreateOrUpdateExample(
pPropValArr[2].Name = "Text";
pPropValArr[2].Value <<= OUString(aToken.sText);
}
- beans::PropertyValues* pValues = aSequPropVals.getArray();
+ beans::PropertyValues* pValues = aSequPropVals.getArray();
pValues[nTokenIndex] = aPropVals;
nTokenIndex++;
diff --git a/sw/source/uibase/app/docst.cxx b/sw/source/uibase/app/docst.cxx
index ffbd62695004..aa37cc213d06 100644
--- a/sw/source/uibase/app/docst.cxx
+++ b/sw/source/uibase/app/docst.cxx
@@ -272,7 +272,6 @@ void SwDocShell::ExecStyleSheet( SfxRequest& rReq )
const SfxItemSet* pArgs = rReq.GetArgs();
const SfxPoolItem* pItem;
- SwWrtShell* pActShell = 0;
switch (nSlot)
{
case SID_STYLE_NEW:
@@ -347,6 +346,7 @@ void SwDocShell::ExecStyleSheet( SfxRequest& rReq )
OUString aParam;
sal_uInt16 nFamily = SFX_STYLE_FAMILY_PARA;
sal_uInt16 nMask = 0;
+ SwWrtShell* pActShell = 0;
if( !pArgs )
{
diff --git a/sw/source/uibase/sidebar/StylePresetsPanel.cxx b/sw/source/uibase/sidebar/StylePresetsPanel.cxx
index da36ab5378a1..ab1ca1189c6c 100644
--- a/sw/source/uibase/sidebar/StylePresetsPanel.cxx
+++ b/sw/source/uibase/sidebar/StylePresetsPanel.cxx
@@ -48,12 +48,11 @@ namespace {
void renderPreview(sfx2::StyleManager* pStyleManager, OutputDevice& aOutputDevice,
OUString const & sName, sal_Int32 nHeight, Rectangle& aRect)
{
- sfx2::StylePreviewRenderer* pStylePreviewRenderer;
-
SfxStyleSheetBase* pStyleSheet = pStyleManager->Search(sName, SFX_STYLE_FAMILY_PARA);
if (pStyleSheet)
{
+ sfx2::StylePreviewRenderer* pStylePreviewRenderer;
pStylePreviewRenderer = pStyleManager->CreateStylePreviewRenderer(aOutputDevice, pStyleSheet, nHeight);
pStylePreviewRenderer->recalculate();
pStylePreviewRenderer->render(aRect, sfx2::StylePreviewRenderer::RenderAlign::TOP);