Resolves: fdo#66700 don't crash on querying zoom state with no SfxObjectShell

Change-Id: Id2943c92ce6deaae3e4d507a35c08466db21cece
This commit is contained in:
Caolán McNamara 2013-08-30 16:06:44 +01:00
parent 0f3895a78e
commit dd0f6c737b

View file

@ -602,6 +602,10 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq )
case SID_ZOOM_ENTIRE_PAGE:
case SID_ZOOM_PAGE_WIDTH:
{
SfxObjectShell* pCurrentShell = SfxObjectShell::Current();
if (!pCurrentShell)
return;
// make sure aZoom is initialized with a proper value if SetType
// doesn't work
SvxZoomItem aZoom( SVX_ZOOM_PERCENT, 100 );
@ -634,7 +638,7 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq )
break;
}
SfxViewFrame::Current()->GetDispatcher()->Execute(SID_ATTR_ZOOM, SFX_CALLMODE_ASYNCHRON, &aZoom, 0L);
pCurrentShell->GetDispatcher()->Execute(SID_ATTR_ZOOM, SFX_CALLMODE_ASYNCHRON, &aZoom, 0L);
break;
}
@ -818,8 +822,11 @@ void SfxApplication::MiscState_Impl(SfxItemSet &rSet)
case SID_ZOOM_ENTIRE_PAGE:
case SID_ZOOM_PAGE_WIDTH:
{
SfxObjectShell* pCurrentShell = SfxObjectShell::Current();
const SfxPoolItem *pItem;
SfxItemState aState = SfxViewFrame::Current()->GetDispatcher()->QueryState(SID_ATTR_ZOOM, pItem);
SfxItemState aState = pCurrentShell ?
pCurrentShell->GetDispatcher()->QueryState(SID_ATTR_ZOOM, pItem) : SFX_ITEM_DISABLED;
if ( aState == SFX_ITEM_DISABLED )
rSet.DisableItem( nWhich );
}