summaryrefslogtreecommitdiff
path: root/sw/source/core/edit/editsh.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/core/edit/editsh.cxx')
-rw-r--r--sw/source/core/edit/editsh.cxx21
1 files changed, 17 insertions, 4 deletions
diff --git a/sw/source/core/edit/editsh.cxx b/sw/source/core/edit/editsh.cxx
index 8f2d13ae6d9d..dde9409d7499 100644
--- a/sw/source/core/edit/editsh.cxx
+++ b/sw/source/core/edit/editsh.cxx
@@ -798,12 +798,25 @@ void SwEditShell::SetNumberingRestart()
SwTxtNode* pTxtNd( static_cast<SwTxtNode*>(pNd) );
SwNumRule* pNumRule( pTxtNd->GetNumRule() );
- if ( pNumRule && pTxtNd->GetNum() &&
+ bool bIsNodeNum =
+ ( pNumRule && pTxtNd->GetNum() &&
( pTxtNd->HasNumber() || pTxtNd->HasBullet() ) &&
pTxtNd->IsCountedInList() &&
- !pTxtNd->IsListRestart() &&
- pTxtNd->GetNum()->GetNumber() ==
- pNumRule->Get( static_cast<sal_uInt16>(pTxtNd->GetActualListLevel()) ).GetStart() )
+ !pTxtNd->IsListRestart() );
+ if (bIsNodeNum)
+ {
+ int nListLevel = pTxtNd->GetActualListLevel();
+
+ if (nListLevel < 0)
+ nListLevel = 0;
+
+ if (nListLevel >= MAXLEVEL)
+ nListLevel = MAXLEVEL - 1;
+
+ bIsNodeNum = pTxtNd->GetNum()->GetNumber() ==
+ pNumRule->Get( static_cast<sal_uInt16>(nListLevel) ).GetStart();
+ }
+ if (bIsNodeNum)
{
// now set a the start value as attribute
SwPosition aCurrentNode(*pNd);