diff options
author | Kurt Zenker <kz@openoffice.org> | 2008-04-03 14:21:02 +0000 |
---|---|---|
committer | Kurt Zenker <kz@openoffice.org> | 2008-04-03 14:21:02 +0000 |
commit | a3b855e2c35f2711d8563a8c6121afef2c2f50d6 (patch) | |
tree | a925b6b8b3fae691b61cd7226ea7011423eaaa63 /sd/source/ui/view/presvish.cxx | |
parent | 263b757f611f6c81a8d2729bfac0e21cc54a9158 (diff) |
INTEGRATION: CWS presenterview (1.36.52); FILE MERGED
2008/01/09 18:28:27 cl 1.36.52.4: #i15900# slideshow api consolidation
2007/12/13 10:30:10 af 1.36.52.3: RESYNC: (1.37-1.38); FILE MERGED
2007/04/19 16:10:51 af 1.36.52.2: RESYNC: (1.36-1.37); FILE MERGED
2007/03/12 14:21:57 af 1.36.52.1: #i75320# Moved code for starting a presentation to PresentationStarter.
Diffstat (limited to 'sd/source/ui/view/presvish.cxx')
-rw-r--r-- | sd/source/ui/view/presvish.cxx | 241 |
1 files changed, 15 insertions, 226 deletions
diff --git a/sd/source/ui/view/presvish.cxx b/sd/source/ui/view/presvish.cxx index 3a07dccd77e5..1b32f84a7ab8 100644 --- a/sd/source/ui/view/presvish.cxx +++ b/sd/source/ui/view/presvish.cxx @@ -4,9 +4,9 @@ * * $RCSfile: presvish.cxx,v $ * - * $Revision: 1.38 $ + * $Revision: 1.39 $ * - * last change: $Author: ihi $ $Date: 2007-11-26 17:04:17 $ + * last change: $Author: kz $ $Date: 2008-04-03 15:21:02 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -36,6 +36,8 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sd.hxx" +#include <com/sun/star/presentation/XSlideShowController.hpp> + #ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_ #include <com/sun/star/lang/XMultiServiceFactory.hpp> #endif @@ -105,6 +107,7 @@ using ::rtl::OUString; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::presentation; namespace sd { @@ -130,78 +133,21 @@ SFX_IMPL_INTERFACE( PresentationViewShell, DrawViewShell, SdResId( STR_PRESVIEWS TYPEINIT1( PresentationViewShell, DrawViewShell ); - - - -PresentationViewShell::PresentationViewShell ( - SfxViewFrame* pFrame, - ViewShellBase& rViewShellBase, - ::Window* pParentWindow, - FrameView* pFrameView) - : DrawViewShell ( - pFrame, - rViewShellBase, - pParentWindow, - PK_STANDARD, - pFrameView), - mbShowStarted( sal_False ) -{ - if( GetDocSh() && GetDocSh()->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED ) - maOldVisArea = GetDocSh()->GetVisArea( ASPECT_CONTENT ); - meShellType = ST_PRESENTATION; -} - - - - -PresentationViewShell::PresentationViewShell ( - SfxViewFrame* pFrame, - ::Window* pParentWindow, - const DrawViewShell& rShell) - : DrawViewShell (pFrame, pParentWindow, rShell), - mbShowStarted( sal_False ) +PresentationViewShell::PresentationViewShell( SfxViewFrame* pFrame, ViewShellBase& rViewShellBase, ::Window* pParentWindow, FrameView* pFrameView) +: DrawViewShell( pFrame, rViewShellBase, pParentWindow, PK_STANDARD, pFrameView) { if( GetDocSh() && GetDocSh()->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED ) maOldVisArea = GetDocSh()->GetVisArea( ASPECT_CONTENT ); meShellType = ST_PRESENTATION; } - - - PresentationViewShell::~PresentationViewShell (void) { if( GetDocSh() && GetDocSh()->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED && !maOldVisArea.IsEmpty() ) GetDocSh()->SetVisArea( maOldVisArea ); - - if( GetViewFrame() && GetViewFrame()->GetTopFrame() ) - { - WorkWindow* pWorkWindow = (WorkWindow*) GetViewFrame()->GetTopFrame()->GetWindow().GetParent(); - - if( pWorkWindow ) - { - pWorkWindow->StartPresentationMode( FALSE, mpSlideShow ? mpSlideShow->isAlwaysOnTop() : 0 ); - } - - } - - if( mpSlideShow ) - { - mpSlideShow->deactivate(); - mpSlideShow->stopShow(); - mpSlideShow->dispose(); - delete mpSlideShow; - mpSlideShow = NULL; - } } - - - -void PresentationViewShell::FinishInitialization ( - FrameView* pFrameView, - SfxRequest& rRequest, - USHORT nPageNumber) +void PresentationViewShell::FinishInitialization( FrameView* pFrameView ) { DrawViewShell::Init(true); @@ -214,30 +160,10 @@ void PresentationViewShell::FinishInitialization ( pFrameView->Connect(); } SetRuler(false); - SwitchPage (nPageNumber); +// SwitchPage (nPageNumber); WriteFrameViewData(); - mpSlideShow = new sd::Slideshow( this, GetView(), GetDoc(), - GetViewShellBase().GetViewWindow() ); - mpSlideShow->setRehearseTimings( - rRequest.GetSlot() == SID_REHEARSE_TIMINGS ); GetActiveWindow()->GrabFocus(); - - // Start the show. - if (mpSlideShow->startShow(0)) - { - mbShowStarted = sal_True; - - Resize(); - GetViewFrame()->Show(); - - Activate(TRUE); - } - else - { - if( GetViewFrame() && GetViewFrame()->GetDispatcher() ) - GetViewFrame()->GetDispatcher()->Execute(SID_PRESENTATION_END, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD ); - } } @@ -263,161 +189,24 @@ void PresentationViewShell::Activate( BOOL bIsMDIActivate ) GetViewFrame()->GetDispatcher()->Execute( SID_NAVIGATOR_INIT, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aItem, 0L ); - if( mpSlideShow) - mpSlideShow->activate(); + rtl::Reference< SlideShow > xSlideShow( SlideShow::GetSlideShow( GetViewShellBase() ) ); + if( xSlideShow.is() ) + xSlideShow->activate(GetViewShellBase()); if( HasCurrentFunction() ) GetCurrentFunction()->Activate(); - - //HMHif( pView ) - //HMH pView->ShowMarkHdl(); } if( bIsMDIActivate ) ReadFrameViewData( mpFrameView ); GetDocSh()->Connect( this ); - - if( mpSlideShow && !mbShowStarted ) - { - if (mpSlideShow->startShow(0)) - mbShowStarted = sal_True; - else { - delete mpSlideShow; - mpSlideShow = 0; - } - } } - - - void PresentationViewShell::Paint( const Rectangle& rRect, ::sd::Window* ) { - // allow paints only if show is already started - if( mbShowStarted && mpSlideShow ) - mpSlideShow->paint(rRect); -} - - - - -void PresentationViewShell::CreateFullScreenShow ( - ViewShellBase& rViewShellBase, - SfxRequest& rRequest) -{ - CreateFullScreenShow( - rViewShellBase.GetDocument(), - rViewShellBase.GetDocument()->GetSdPage(0, PK_STANDARD), - NULL, - rRequest); -} - - - - -void PresentationViewShell::CreateFullScreenShow ( - ViewShell* pOriginShell, - SfxRequest& rRequest) -{ - CreateFullScreenShow( - pOriginShell->GetDoc(), - pOriginShell->GetActualPage(), - pOriginShell->GetFrameView(), - rRequest); -} - - - - -void PresentationViewShell::CreateFullScreenShow ( - SdDrawDocument* pDocument, - SdPage* pCurrentPage, - FrameView* pFrameView, - SfxRequest& rRequest) -{ - SFX_REQUEST_ARG (rRequest, pAlwaysOnTop, SfxBoolItem, - ATTR_PRESENT_ALWAYS_ON_TOP, FALSE); - bool bAlwaysOnTop = - ((rRequest.GetSlot() != SID_REHEARSE_TIMINGS) && pAlwaysOnTop ) - ? pAlwaysOnTop->GetValue() - : pDocument->getPresentationSettings().mbAlwaysOnTop; - - SdOptions* pOptions = SD_MOD()->GetSdOptions(DOCUMENT_TYPE_IMPRESS); - - sal_Int32 nDisplay = pOptions->GetDisplay(); - - if( nDisplay <= 0 ) - { - try - { - Reference< XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW ); - Reference< XPropertySet > xMonProps( xFactory->createInstance(OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.DisplayAccess" ) ) ), UNO_QUERY_THROW ); - const OUString sPropName( RTL_CONSTASCII_USTRINGPARAM( "DefaultDisplay" ) ); - xMonProps->getPropertyValue( sPropName ) >>= nDisplay; - } - catch( Exception& ) - { - } - } - else - { - nDisplay--; - } - - WorkWindow* pWorkWindow = new WorkWindow ( - NULL, - WB_HIDE | WB_CLIPCHILDREN); - pWorkWindow->StartPresentationMode ( - TRUE, - bAlwaysOnTop ? PRESENTATION_HIDEALLAPPS : 0, - nDisplay ); - - pWorkWindow->SetBackground(Wallpaper(COL_BLACK)); - if (pWorkWindow->IsVisible()) - { - // The new frame is created hidden. To make it visible and activate - // the new view shell--a prerequisite to process slot calls and - // initialize its panes--a GrabFocus() has to be called later on. - SfxTopFrame* pNewFrame = SfxTopFrame::Create ( - pDocument->GetDocSh(), - pWorkWindow, - PRESENTATION_FACTORY_ID, - TRUE); - pNewFrame->SetPresentationMode (TRUE); - - ViewShellBase* pBase = static_cast<ViewShellBase*>( - pNewFrame->GetCurrentViewFrame()->GetViewShell()); - if (pBase != NULL) - { - // Get the page where the show is to be started. This normally - // is the current page of the shell from which the show has been - // started. This, however, may be NULL, e.g. when started from - // the slide sorter and that has an empty selection. - USHORT nStartPage = 0; - if (pCurrentPage != NULL) - nStartPage = (pCurrentPage->GetPageNum() - 1) / 2; - - // The following GrabFocus() is responsible for activating the - // new view shell. Without it the screen remains blank (under - // Windows and some Linux variants.) - pBase->GetWindow()->GrabFocus(); - - PresentationViewShell* pShell = dynamic_cast<PresentationViewShell*>( - pBase->GetMainViewShell().get()); - if (pShell != NULL) - { - // Initialize the new presentation view shell with a copy of - // the frame view of the current view shell. This avoids - // that changes made by the presentation have an effect on - // the other view shells. - FrameView* pFrameViewCopy = new FrameView(pDocument, pFrameView); - pShell->FinishInitialization ( - pFrameViewCopy, - rRequest, - nStartPage); - } - } - } + rtl::Reference< SlideShow > xSlideShow( SlideShow::GetSlideShow( GetViewShellBase() ) ); + if( xSlideShow.is() ) + xSlideShow->paint(rRect); } } // end of namespace sd |