diff options
Diffstat (limited to 'svx/source/outliner/outliner.cxx')
-rw-r--r-- | svx/source/outliner/outliner.cxx | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/svx/source/outliner/outliner.cxx b/svx/source/outliner/outliner.cxx index 6178f1f3e717..19a92f91f4fc 100644 --- a/svx/source/outliner/outliner.cxx +++ b/svx/source/outliner/outliner.cxx @@ -332,7 +332,11 @@ void Outliner::SetNumberingStartValue( sal_uInt16 nPara, sal_Int16 nNumberingSta pPara->IsParaIsNumberingRestart(), pPara->IsParaIsNumberingRestart() ) ); pPara->SetNumberingStartValue( nNumberingStartValue ); - ImplCheckParagraphs( nPara, (USHORT) (pParaList->GetParagraphCount()-1) ); + // --> OD 2009-03-10 #i100014# + // It is not a good idea to substract 1 from a count and cast the result + // to USHORT without check, if the count is 0. + ImplCheckParagraphs( nPara, (USHORT) (pParaList->GetParagraphCount()) ); + // <-- pEditEngine->SetModified(); } } @@ -356,7 +360,11 @@ void Outliner::SetParaIsNumberingRestart( sal_uInt16 nPara, sal_Bool bParaIsNumb pPara->IsParaIsNumberingRestart(), bParaIsNumberingRestart ) ); pPara->SetParaIsNumberingRestart( bParaIsNumberingRestart ); - ImplCheckParagraphs( nPara, (USHORT) (pParaList->GetParagraphCount()-1) ); + // --> OD 2009-03-10 #i100014# + // It is not a good idea to substract 1 from a count and cast the result + // to USHORT without check, if the count is 0. + ImplCheckParagraphs( nPara, (USHORT) (pParaList->GetParagraphCount()) ); + // <-- pEditEngine->SetModified(); } } @@ -596,7 +604,11 @@ void Outliner::SetText( const OutlinerParaObject& rPObj ) ImplCheckNumBulletItem( nCurPara ); } - ImplCheckParagraphs( 0, (USHORT) (pParaList->GetParagraphCount()-1) ); + // --> OD 2009-03-10 #i100014# + // It is not a good idea to substract 1 from a count and cast the result + // to USHORT without check, if the count is 0. + ImplCheckParagraphs( 0, (USHORT) (pParaList->GetParagraphCount()) ); + // <-- EnableUndo( bUndo ); ImplBlockInsertionCallbacks( FALSE ); @@ -639,7 +651,11 @@ void Outliner::AddText( const OutlinerParaObject& rPObj ) } DBG_ASSERT( pEditEngine->GetParagraphCount()==pParaList->GetParagraphCount(), "SetText: OutOfSync" ); - ImplCheckParagraphs( (USHORT)nPara, (USHORT) (pParaList->GetParagraphCount()-1) ); + // --> OD 2009-03-10 #i100014# + // It is not a good idea to substract 1 from a count and cast the result + // to USHORT without check, if the count is 0. + ImplCheckParagraphs( (USHORT)nPara, (USHORT) (pParaList->GetParagraphCount()) ); + // <-- ImplBlockInsertionCallbacks( FALSE ); pEditEngine->SetUpdateMode( bUpdate ); @@ -1501,7 +1517,10 @@ void Outliner::ImplCheckParagraphs( USHORT nStart, USHORT nEnd ) { DBG_CHKTHIS( Outliner, 0 ); - for ( USHORT n = nStart; n <= nEnd; n++ ) + // --> OD 2009-03-10 #i100014# + // assure that the following for-loop does not loop forever + for ( ULONG n = nStart; n < nEnd; n++ ) + // <-- { Paragraph* pPara = pParaList->GetParagraph( n ); if (pPara) |