summaryrefslogtreecommitdiff
path: root/svx/source
diff options
context:
space:
mode:
Diffstat (limited to 'svx/source')
-rw-r--r--svx/source/outliner/outleeng.cxx6
-rw-r--r--svx/source/outliner/outliner.cxx29
-rw-r--r--svx/source/outliner/outlvw.cxx16
3 files changed, 41 insertions, 10 deletions
diff --git a/svx/source/outliner/outleeng.cxx b/svx/source/outliner/outleeng.cxx
index 3ee790dc44..43fea6e316 100644
--- a/svx/source/outliner/outleeng.cxx
+++ b/svx/source/outliner/outleeng.cxx
@@ -228,7 +228,11 @@ void OutlinerEditEng::SetParaAttribs( USHORT nPara, const SfxItemSet& rSet )
EditEngine::SetParaAttribs( (USHORT)nPara, rSet );
pOwner->ImplCheckNumBulletItem( (USHORT)nPara );
- pOwner->ImplCheckParagraphs( (USHORT)nPara, (USHORT) (pOwner->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.
+ pOwner->ImplCheckParagraphs( (USHORT)nPara, (USHORT) (pOwner->pParaList->GetParagraphCount()) );
+ // <--
if ( !IsInUndo() && IsUndoEnabled() )
pOwner->UndoActionEnd( OLUNDO_ATTR );
diff --git a/svx/source/outliner/outliner.cxx b/svx/source/outliner/outliner.cxx
index 988a73dab7..7a298c4c4b 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)
diff --git a/svx/source/outliner/outlvw.cxx b/svx/source/outliner/outlvw.cxx
index a415692ad4..73e5d7617c 100644
--- a/svx/source/outliner/outlvw.cxx
+++ b/svx/source/outliner/outlvw.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -1192,7 +1192,11 @@ void OutlinerView::ToggleBullets()
}
}
- USHORT nParaCount = (USHORT) (pOwner->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.
+ USHORT nParaCount = (USHORT) (pOwner->pParaList->GetParagraphCount());
+ // <--
pOwner->ImplCheckParagraphs( aSel.nStartPara, nParaCount );
pOwner->pEditEngine->QuickMarkInvalid( ESelection( aSel.nStartPara, 0, nParaCount, 0 ) );
@@ -1222,7 +1226,11 @@ void OutlinerView::EnableBullets()
}
}
- USHORT nParaCount = (USHORT) (pOwner->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.
+ USHORT nParaCount = (USHORT) (pOwner->pParaList->GetParagraphCount());
+ // <--
pOwner->ImplCheckParagraphs( aSel.nStartPara, nParaCount );
pOwner->pEditEngine->QuickMarkInvalid( ESelection( aSel.nStartPara, 0, nParaCount, 0 ) );
@@ -1235,7 +1243,7 @@ void OutlinerView::EnableBullets()
void OutlinerView::RemoveAttribsKeepLanguages( BOOL bRemoveParaAttribs )
{
RemoveAttribs( bRemoveParaAttribs, 0, TRUE /*keep language attribs*/ );
-}
+}
void OutlinerView::RemoveAttribs( BOOL bRemoveParaAttribs, USHORT nWhich, BOOL bKeepLanguages )
{