summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2017-12-19 16:38:05 +0200
committerTor Lillqvist <tml@collabora.com>2017-12-20 08:59:51 +0100
commitae71020598362784b39eb4f67178166754db6fe0 (patch)
treef90e61f0b28398386f69d309b950d2b58fd3eb28
parent2dfd6c4f6e5c379facf4ae9c1956dea11455f034 (diff)
Remove unnecessary nested block level
Change-Id: I06fb2d13bf39d636151396a2cbac35b3403ffe39 Reviewed-on: https://gerrit.libreoffice.org/46798 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Tor Lillqvist <tml@collabora.com>
-rw-r--r--sw/source/core/docnode/nodes.cxx82
1 files changed, 40 insertions, 42 deletions
diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx
index 79c8076c11b1..510cbd938e33 100644
--- a/sw/source/core/docnode/nodes.cxx
+++ b/sw/source/core/docnode/nodes.cxx
@@ -2212,57 +2212,55 @@ void SwNodes::ForEach( const SwNodeIndex& rStart, const SwNodeIndex& rEnd,
void SwNodes::RemoveNode( sal_uLong nDelPos, sal_uLong nSz, bool bDel )
{
- {
#ifndef NDEBUG
- SwNode *const pFirst((*this)[nDelPos]);
+ SwNode *const pFirst((*this)[nDelPos]);
#endif
- for (sal_uLong nCnt = 0; nCnt < nSz; nCnt++)
- {
- SwNode* pNode = ((*this)[ nDelPos + nCnt ]);
- SwTextNode * pTextNd = pNode->GetTextNode();
+ for (sal_uLong nCnt = 0; nCnt < nSz; nCnt++)
+ {
+ SwNode* pNode = ((*this)[ nDelPos + nCnt ]);
+ SwTextNode * pTextNd = pNode->GetTextNode();
- if (pTextNd)
+ if (pTextNd)
+ {
+ pTextNd->RemoveFromList();
+ // remove RndStdIds::FLY_AS_CHAR *before* adjusting SwNodeIndex
+ // so their anchor still points to correct node when deleted!
+ // NOTE: this will call RemoveNode() recursively!
+ // so adjust our indexes to account for removed nodes
+ sal_uLong const nPos = pTextNd->GetIndex();
+ SwpHints *const pHints(pTextNd->GetpSwpHints());
+ if (pHints)
{
- pTextNd->RemoveFromList();
- // remove RndStdIds::FLY_AS_CHAR *before* adjusting SwNodeIndex
- // so their anchor still points to correct node when deleted!
- // NOTE: this will call RemoveNode() recursively!
- // so adjust our indexes to account for removed nodes
- sal_uLong const nPos = pTextNd->GetIndex();
- SwpHints *const pHints(pTextNd->GetpSwpHints());
- if (pHints)
+ std::vector<SwTextAttr*> flys;
+ for (size_t i = 0; i < pHints->Count(); ++i)
{
- std::vector<SwTextAttr*> flys;
- for (size_t i = 0; i < pHints->Count(); ++i)
+ SwTextAttr *const pHint(pHints->Get(i));
+ if (RES_TXTATR_FLYCNT == pHint->Which())
{
- SwTextAttr *const pHint(pHints->Get(i));
- if (RES_TXTATR_FLYCNT == pHint->Which())
- {
- flys.push_back(pHint);
- }
+ flys.push_back(pHint);
}
- for (SwTextAttr * pHint : flys)
- {
- pTextNd->DeleteAttribute(pHint);
- } // pHints may be dead now
- sal_uLong const nDiff = nPos - pTextNd->GetIndex();
- if (nDiff)
- {
- nDelPos -= nDiff;
- }
- assert(pTextNd == (*this)[nDelPos + nCnt]);
- assert(pFirst == (*this)[nDelPos]);
}
+ for (SwTextAttr * pHint : flys)
+ {
+ pTextNd->DeleteAttribute(pHint);
+ } // pHints may be dead now
+ sal_uLong const nDiff = nPos - pTextNd->GetIndex();
+ if (nDiff)
+ {
+ nDelPos -= nDiff;
+ }
+ assert(pTextNd == (*this)[nDelPos + nCnt]);
+ assert(pFirst == (*this)[nDelPos]);
}
- SwTableNode* pTableNode = pNode->GetTableNode();
- if (pTableNode)
- {
- // The node that is deleted is a table node.
- // Need to make sure that all the redlines that are
- // related to this table are removed from the
- // 'Extra Redlines' array
- pTableNode->RemoveRedlines();
- }
+ }
+ SwTableNode* pTableNode = pNode->GetTableNode();
+ if (pTableNode)
+ {
+ // The node that is deleted is a table node.
+ // Need to make sure that all the redlines that are
+ // related to this table are removed from the
+ // 'Extra Redlines' array
+ pTableNode->RemoveRedlines();
}
}