Index: source/ui/slideshow/slideshowimpl.hxx
===================================================================
RCS file: /cvs/graphics/sd/source/ui/slideshow/slideshowimpl.hxx,v
retrieving revision 1.18
retrieving revision 1.18.62.1
diff -u -r1.18 -r1.18.62.1
--- sd/source/ui/slideshow/slideshowimpl.hxx        13 Jul 2006 09:54:14 -0000     1.18
+++ sd/source/ui/slideshow/slideshowimpl.hxx     18 Sep 2006 13:53:29 -0000  1.18.62.1
@@ -320,6 +320,8 @@
                const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aProperties );

        SfxViewFrame* getViewFrame() const;
+       SfxDispatcher* getDispatcher() const;
+       SfxBindings* getBindings() const;

        sal_Int32 getSlideNumberForBookmark( const rtl::OUString& rStrBookmark );

Index: source/ui/slideshow/slideshowimpl.cxx
===================================================================
RCS file: /opt/sourcecast/data/ccvs/repository/graphics/sd/source/ui/slideshow/slideshowimpl.cxx,v
retrieving revision 1.31
retrieving revision 1.31.60.1
diff -u -r1.31 -r1.31.60.1
--- sd/source/ui/slideshow/slideshowimpl.cxx	2006/07/13 09:53:56	1.31
+++ sd/source/ui/slideshow/slideshowimpl.cxx	2006/09/15 15:17:46	1.31.60.1
@@ -817,7 +817,7 @@
 		hideChildWindows();
 
 		::Window* pParent;
-        pParent = &getViewFrame()->GetWindow();
+		pParent = getViewFrame() ? &getViewFrame()->GetWindow() : 0;
 
 		mpShowWindow = new ShowWindow( pParent );
 		mpShowWindow->SetMouseAutoHide( !maPresSettings.mbMouseVisible );
@@ -828,12 +828,16 @@
 			mpViewShell->GetViewShellBase().ShowUIControls (false);
             mpPaneHider.reset(new PaneHider(*mpViewShell));
 
-			mpViewShell->GetViewFrame()->SetChildWindow( SID_NAVIGATOR, maPresSettings.mbStartWithNavigator );
+			if( getViewFrame() )
+				getViewFrame()->SetChildWindow( SID_NAVIGATOR, maPresSettings.mbStartWithNavigator );
 		}
 
 		// these Slots are forbiden in other views for this document
-		mpDocSh->SetSlotFilter( TRUE, sizeof( pAllowed ) / sizeof( USHORT ), pAllowed );
-		mpDocSh->ApplySlotFilter();
+		if( mpDocSh )
+		{
+			mpDocSh->SetSlotFilter( TRUE, sizeof( pAllowed ) / sizeof( USHORT ), pAllowed );
+			mpDocSh->ApplySlotFilter();
+		}
 
 		Help::DisableContextHelp();
 		Help::DisableExtHelp();
@@ -851,7 +855,7 @@
 
 		// call resize handler
 		maPresSize = pParent->GetSizePixel();
-		if( !maPresSettings.mbFullScreen )
+		if( !maPresSettings.mbFullScreen && mpViewShell )
 		{
 			const Rectangle& aClientRect = mpViewShell->GetViewShellBase().getClientRectangle();
 			maPresSize = aClientRect.GetSize();
@@ -884,9 +888,12 @@
 			mpView->SetAnimationPause( TRUE );
 		}
 
-		SfxBindings& rBindings = getViewFrame()->GetBindings();
-		rBindings.Invalidate( SID_PRESENTATION );
-		rBindings.Invalidate( SID_REHEARSE_TIMINGS );
+		SfxBindings* pBindings = getBindings();
+		if( pBindings )
+		{
+			pBindings->Invalidate( SID_PRESENTATION );
+			pBindings->Invalidate( SID_REHEARSE_TIMINGS );
+		}
 
 		mpShowWindow->GrabFocus();
 
@@ -1159,10 +1166,10 @@
 		}
 
 		// restart the custom show dialog if he started us
-		if( mpViewShell->IsStartShowWithDialog() )
+		if( mpViewShell->IsStartShowWithDialog() && getDispatcher() )
 		{
 			mpViewShell->SetStartShowWithDialog( FALSE );
-			getViewFrame()->GetDispatcher()->Execute( SID_CUSTOMSHOW_DLG, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD );
+			getDispatcher()->Execute( SID_CUSTOMSHOW_DLG, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD );
 		}
 
 		mpViewShell->GetViewShellBase().UpdateBorder(true);
@@ -1437,10 +1444,12 @@
 		registerShapeEvents(mpSlideController->getCurrentSlideNumber());
 		update();
 
-		SfxBindings& rBindings = getViewFrame()->GetBindings();
-		rBindings.Invalidate( SID_NAVIGATOR_STATE );
-		rBindings.Invalidate( SID_NAVIGATOR_PAGENAME );
-
+		SfxBindings* pBindings = getBindings();
+		if( pBindings )
+		{
+			pBindings->Invalidate( SID_NAVIGATOR_STATE );
+			pBindings->Invalidate( SID_NAVIGATOR_PAGENAME );
+		}
 	}
 }
 
@@ -2151,16 +2160,20 @@
 
 	PopupMenu* pPageMenu = pMenu->GetPopupMenu( CM_GOTO );
 
-	if( mpViewShell && mpViewShell->GetViewShellBase().GetViewFrame() )
+	SfxViewFrame* pViewFrame = getViewFrame();
+	if( pViewFrame && pViewFrame->GetFrame() )
 	{
-		::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xFrame( mpViewShell->GetViewShellBase().GetViewFrame()->GetFrame()->GetFrameInterface() );
-		pMenu->SetItemImage( CM_NEXT_SLIDE, GetImage( xFrame, OUString( RTL_CONSTASCII_USTRINGPARAM( "slot:10617") ), FALSE, FALSE ) );
-		pMenu->SetItemImage( CM_PREV_SLIDE, GetImage( xFrame, OUString( RTL_CONSTASCII_USTRINGPARAM( "slot:10618") ), FALSE, FALSE ) );
-
-		if( pPageMenu )
+		::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xFrame( pViewFrame->GetFrame()->GetFrameInterface() );
+		if( xFrame.is() )
 		{
-			pPageMenu->SetItemImage( CM_FIRST_SLIDE, GetImage( xFrame, OUString( RTL_CONSTASCII_USTRINGPARAM( "slot:10616") ), FALSE, FALSE ) );
-			pPageMenu->SetItemImage( CM_LAST_SLIDE, GetImage( xFrame, OUString( RTL_CONSTASCII_USTRINGPARAM( "slot:10619") ), FALSE, FALSE ) );
+			pMenu->SetItemImage( CM_NEXT_SLIDE, GetImage( xFrame, OUString( RTL_CONSTASCII_USTRINGPARAM( "slot:10617") ), FALSE, FALSE ) );
+			pMenu->SetItemImage( CM_PREV_SLIDE, GetImage( xFrame, OUString( RTL_CONSTASCII_USTRINGPARAM( "slot:10618") ), FALSE, FALSE ) );
+
+			if( pPageMenu )
+			{
+				pPageMenu->SetItemImage( CM_FIRST_SLIDE, GetImage( xFrame, OUString( RTL_CONSTASCII_USTRINGPARAM( "slot:10616") ), FALSE, FALSE ) );
+				pPageMenu->SetItemImage( CM_LAST_SLIDE, GetImage( xFrame, OUString( RTL_CONSTASCII_USTRINGPARAM( "slot:10619") ), FALSE, FALSE ) );
+			}
 		}
 	}
 
@@ -2426,17 +2439,20 @@
 	{
 		SfxViewFrame* pViewFrame = getViewFrame();
 
-		if( pViewFrame->GetChildWindow( SID_NAVIGATOR ) != NULL )
-			mnChildMask |= NAVIGATOR_CHILD_MASK;
-
-		for( ULONG i = 0, nCount = sizeof( aShowChilds ) / sizeof( FncGetChildWindowId ); i < nCount; i++ )
+		if( pViewFrame )
 		{
-			const USHORT nId = ( *aShowChilds[ i ] )();
+			if( pViewFrame->GetChildWindow( SID_NAVIGATOR ) != NULL )
+				mnChildMask |= NAVIGATOR_CHILD_MASK;
 
-			if( pViewFrame->GetChildWindow( nId ) )
+			for( ULONG i = 0, nCount = sizeof( aShowChilds ) / sizeof( FncGetChildWindowId ); i < nCount; i++ )
 			{
-				pViewFrame->SetChildWindow( nId, FALSE );
-				mnChildMask |= 1 << i;
+				const USHORT nId = ( *aShowChilds[ i ] )();
+
+				if( pViewFrame->GetChildWindow( nId ) )
+				{
+					pViewFrame->SetChildWindow( nId, FALSE );
+					mnChildMask |= 1 << i;
+				}
 			}
 		}
 	}
@@ -2447,19 +2463,32 @@
 	if( ANIMATIONMODE_SHOW == meAnimationMode )
 	{
 		SfxViewFrame* pViewFrame = getViewFrame();
-		pViewFrame->SetChildWindow( SID_NAVIGATOR, ( mnChildMask & NAVIGATOR_CHILD_MASK ) != 0 );
-
-		for( ULONG i = 0, nCount = sizeof( aShowChilds ) / sizeof( FncGetChildWindowId ); i < nCount; i++ )
+		if( pViewFrame )
 		{
-			if( mnChildMask & ( 1 << i ) )
-				pViewFrame->SetChildWindow( ( *aShowChilds[ i ] )(), TRUE );
+			pViewFrame->SetChildWindow( SID_NAVIGATOR, ( mnChildMask & NAVIGATOR_CHILD_MASK ) != 0 );
+
+			for( ULONG i = 0, nCount = sizeof( aShowChilds ) / sizeof( FncGetChildWindowId ); i < nCount; i++ )
+			{
+				if( mnChildMask & ( 1 << i ) )
+					pViewFrame->SetChildWindow( ( *aShowChilds[ i ] )(), TRUE );
+			}
 		}
 	}
 }
 
 SfxViewFrame* SlideshowImpl::getViewFrame() const
 {
-	return mpViewShell ? mpViewShell->GetViewFrame() : SfxViewFrame::Current();
+	return mpViewShell ? mpViewShell->GetViewFrame() : 0;
+}
+
+SfxDispatcher* SlideshowImpl::getDispatcher() const
+{
+	return (mpViewShell && mpViewShell->GetViewFrame()) ? mpViewShell->GetViewFrame()->GetDispatcher() : 0;
+}
+
+SfxBindings* SlideshowImpl::getBindings() const
+{
+	return (mpViewShell && mpViewShell->GetViewFrame()) ? &mpViewShell->GetViewFrame()->GetBindings() : 0;
 }
 
 void SlideshowImpl::resize( const Size& rSize )
@@ -2516,31 +2545,20 @@
 
 		if( mpShowWindow )
 		{
-			SfxDispatcher* pDispatcher = getViewFrame()->GetDispatcher();
+			SfxViewFrame* pViewFrame = getViewFrame();
+			SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : 0;
 
-/* ???
-			if( mpViewShell )
+            hideChildWindows();
+
+			if( pDispatcher )
 			{
-				mpViewShell->Invalidate(SID_OBJECT_ALIGN);
-				mpViewShell->Invalidate(SID_ZOOM_TOOLBOX);
-				mpViewShell->Invalidate(SID_OBJECT_CHOOSE_MODE);
-				mpViewShell->Invalidate(SID_POSITION);
-				mpViewShell->Invalidate(SID_DRAWTBX_TEXT);
-				mpViewShell->Invalidate(SID_DRAWTBX_RECTANGLES);
-				mpViewShell->Invalidate(SID_DRAWTBX_ELLIPSES);
-				mpViewShell->Invalidate(SID_DRAWTBX_LINES);
-				mpViewShell->Invalidate(SID_DRAWTBX_ARROWS);
-				mpViewShell->Invalidate(SID_DRAWTBX_3D_OBJECTS);
-				mpViewShell->Invalidate(SID_DRAWTBX_CONNECTORS);
-				mpViewShell->Invalidate(SID_DRAWTBX_INSERT);
+				// filter all forbiden slots
+				pDispatcher->SetSlotFilter( TRUE, sizeof(pAllowed) / sizeof(USHORT), pAllowed );
 			}
-*/
-            hideChildWindows();
 
-			// filter all forbiden slots
-			pDispatcher->SetSlotFilter( TRUE, sizeof(pAllowed) / sizeof(USHORT), pAllowed );
+			if( getBindings() )
+				getBindings()->InvalidateAll(TRUE);
 
-			getViewFrame()->GetBindings().InvalidateAll(TRUE);
 			mpShowWindow->GrabFocus();
 		}
 	}
