[Libreoffice-commits] core.git: sd/source

Caolán McNamara caolanm at redhat.com
Wed May 21 07:28:10 PDT 2014


 sd/source/ui/view/drawview.cxx |   53 ++++++++++++++++++++++-------------------
 1 file changed, 29 insertions(+), 24 deletions(-)

New commits:
commit 583619b77195256149cbb47d71f09b204bca7c7c
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed May 21 15:02:28 2014 +0100

    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

diff --git a/sd/source/ui/view/drawview.cxx b/sd/source/ui/view/drawview.cxx
index af9f4de..18a181f 100644
--- a/sd/source/ui/view/drawview.cxx
+++ b/sd/source/ui/view/drawview.cxx
@@ -197,35 +197,40 @@ bool DrawView::SetAttributes(const SfxItemSet& rSet,
                         OUString aName = rPage.GetLayoutName() + " " +
                             OUString::number((nDepth <= 0) ? 1 : nDepth + 1);
                         SfxStyleSheet* pSheet = (SfxStyleSheet*)pStShPool->Find(aName, SD_STYLE_FAMILY_MASTERPAGE);
-                        DBG_ASSERT(pSheet, "StyleSheet not found");
-
-                        SfxItemSet aTempSet( pSheet->GetItemSet() );
-                        aTempSet.Put( rSet );
-                        aTempSet.ClearInvalidItems();
-
-                        if( nDepth > 0 && aTempSet.GetItemState( EE_PARA_NUMBULLET ) == SFX_ITEM_ON )
+                        //We have no stylesheet if we access outline level 10
+                        //in the master preview, there is no true style backing
+                        //that entry
+                        SAL_WARN_IF(!pSheet, "sd", "StyleSheet " << aName << " not found");
+                        if (pSheet)
                         {
-                            // no SvxNumBulletItem in outline level 1 to 8!
-                            aTempSet.ClearItem( EE_PARA_NUMBULLET );
-                        }
+                            SfxItemSet aTempSet( pSheet->GetItemSet() );
+                            aTempSet.Put( rSet );
+                            aTempSet.ClearInvalidItems();
 
-                        // Undo-Action
-                        StyleSheetUndoAction* pAction = new StyleSheetUndoAction(&mrDoc, pSheet, &aTempSet);
-                        mpDocSh->GetUndoManager()->AddUndoAction(pAction);
+                            if( nDepth > 0 && aTempSet.GetItemState( EE_PARA_NUMBULLET ) == SFX_ITEM_ON )
+                            {
+                                // no SvxNumBulletItem in outline level 1 to 8!
+                                aTempSet.ClearItem( EE_PARA_NUMBULLET );
+                            }
 
-                        pSheet->GetItemSet().Put(aTempSet);
-                        pSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
+                            // Undo-Action
+                            StyleSheetUndoAction* pAction = new StyleSheetUndoAction(&mrDoc, pSheet, &aTempSet);
+                            mpDocSh->GetUndoManager()->AddUndoAction(pAction);
 
-                        // now also broadcast any child sheets
-                        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));
+                            pSheet->GetItemSet().Put(aTempSet);
+                            pSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
 
-                            if( pOutlSheet )
-                                pOutlSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
+                            // now also broadcast any child sheets
+                            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;


More information about the Libreoffice-commits mailing list