don't crash on formatting outline level 10 in master view
There are only 9 outline level styles, but we are allowed (for some nutball reason) to create 10 levels, trying to change the format of level 10 will then crash when trying to apply its formatting to the non-existent underlying style Change-Id: Ic240322f98d832bc59edb502dd6d4988aa022481
This commit is contained in:
@@ -197,35 +197,40 @@ bool DrawView::SetAttributes(const SfxItemSet& rSet,
|
|||||||
OUString aName = rPage.GetLayoutName() + " " +
|
OUString aName = rPage.GetLayoutName() + " " +
|
||||||
OUString::number((nDepth <= 0) ? 1 : nDepth + 1);
|
OUString::number((nDepth <= 0) ? 1 : nDepth + 1);
|
||||||
SfxStyleSheet* pSheet = (SfxStyleSheet*)pStShPool->Find(aName, SD_STYLE_FAMILY_MASTERPAGE);
|
SfxStyleSheet* pSheet = (SfxStyleSheet*)pStShPool->Find(aName, SD_STYLE_FAMILY_MASTERPAGE);
|
||||||
DBG_ASSERT(pSheet, "StyleSheet not found");
|
//We have no stylesheet if we access outline level 10
|
||||||
|
//in the master preview, there is no true style backing
|
||||||
SfxItemSet aTempSet( pSheet->GetItemSet() );
|
//that entry
|
||||||
aTempSet.Put( rSet );
|
SAL_WARN_IF(!pSheet, "sd", "StyleSheet " << aName << " not found");
|
||||||
aTempSet.ClearInvalidItems();
|
if (pSheet)
|
||||||
|
|
||||||
if( nDepth > 0 && aTempSet.GetItemState( EE_PARA_NUMBULLET ) == SFX_ITEM_ON )
|
|
||||||
{
|
{
|
||||||
// no SvxNumBulletItem in outline level 1 to 8!
|
SfxItemSet aTempSet( pSheet->GetItemSet() );
|
||||||
aTempSet.ClearItem( EE_PARA_NUMBULLET );
|
aTempSet.Put( rSet );
|
||||||
}
|
aTempSet.ClearInvalidItems();
|
||||||
|
|
||||||
// Undo-Action
|
if( nDepth > 0 && aTempSet.GetItemState( EE_PARA_NUMBULLET ) == SFX_ITEM_ON )
|
||||||
StyleSheetUndoAction* pAction = new StyleSheetUndoAction(&mrDoc, pSheet, &aTempSet);
|
{
|
||||||
mpDocSh->GetUndoManager()->AddUndoAction(pAction);
|
// no SvxNumBulletItem in outline level 1 to 8!
|
||||||
|
aTempSet.ClearItem( EE_PARA_NUMBULLET );
|
||||||
|
}
|
||||||
|
|
||||||
pSheet->GetItemSet().Put(aTempSet);
|
// Undo-Action
|
||||||
pSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
|
StyleSheetUndoAction* pAction = new StyleSheetUndoAction(&mrDoc, pSheet, &aTempSet);
|
||||||
|
mpDocSh->GetUndoManager()->AddUndoAction(pAction);
|
||||||
|
|
||||||
// now also broadcast any child sheets
|
pSheet->GetItemSet().Put(aTempSet);
|
||||||
sal_Int16 nChild;
|
pSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
|
||||||
for( nChild = nDepth + 1; nChild < 9; nChild++ )
|
|
||||||
{
|
|
||||||
OUString aSheetName = rPage.GetLayoutName() + " " +
|
|
||||||
OUString::number((nChild <= 0) ? 1 : nChild + 1);
|
|
||||||
SfxStyleSheet* pOutlSheet = static_cast< SfxStyleSheet* >(pStShPool->Find(aSheetName, SD_STYLE_FAMILY_MASTERPAGE));
|
|
||||||
|
|
||||||
if( pOutlSheet )
|
// now also broadcast any child sheets
|
||||||
pOutlSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
|
sal_Int16 nChild;
|
||||||
|
for( nChild = nDepth + 1; nChild < 9; nChild++ )
|
||||||
|
{
|
||||||
|
OUString aSheetName = rPage.GetLayoutName() + " " +
|
||||||
|
OUString::number((nChild <= 0) ? 1 : nChild + 1);
|
||||||
|
SfxStyleSheet* pOutlSheet = static_cast< SfxStyleSheet* >(pStShPool->Find(aSheetName, SD_STYLE_FAMILY_MASTERPAGE));
|
||||||
|
|
||||||
|
if( pOutlSheet )
|
||||||
|
pOutlSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
++iter;
|
++iter;
|
||||||
|
Reference in New Issue
Block a user