1*5b190011SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*5b190011SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*5b190011SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*5b190011SAndrew Rist * distributed with this work for additional information 6*5b190011SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*5b190011SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*5b190011SAndrew Rist * "License"); you may not use this file except in compliance 9*5b190011SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*5b190011SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*5b190011SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*5b190011SAndrew Rist * software distributed under the License is distributed on an 15*5b190011SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*5b190011SAndrew Rist * KIND, either express or implied. See the License for the 17*5b190011SAndrew Rist * specific language governing permissions and limitations 18*5b190011SAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*5b190011SAndrew Rist *************************************************************/ 21*5b190011SAndrew Rist 22*5b190011SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_sd.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <com/sun/star/presentation/XSlideShowController.hpp> 28cdf0e10cSrcweir 29cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp> 30cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp> 31cdf0e10cSrcweir #include <comphelper/processfactory.hxx> 32cdf0e10cSrcweir 33cdf0e10cSrcweir #include "PresentationViewShell.hxx" 34cdf0e10cSrcweir #include "optsitem.hxx" 35cdf0e10cSrcweir #include "sddll.hxx" 36cdf0e10cSrcweir #include <sfx2/request.hxx> 37cdf0e10cSrcweir #ifndef _SFX_DISPATCH_HXX 38cdf0e10cSrcweir #include <sfx2/dispatch.hxx> 39cdf0e10cSrcweir #endif 40cdf0e10cSrcweir 41cdf0e10cSrcweir #include <sfx2/objface.hxx> 42cdf0e10cSrcweir 43cdf0e10cSrcweir #include <svx/svxids.hrc> 44cdf0e10cSrcweir #ifndef SD_FRAME_VIEW 45cdf0e10cSrcweir #include "FrameView.hxx" 46cdf0e10cSrcweir #endif 47cdf0e10cSrcweir #include "sdresid.hxx" 48cdf0e10cSrcweir #include "DrawDocShell.hxx" 49cdf0e10cSrcweir #include "slideshow.hxx" 50cdf0e10cSrcweir #include "sdattr.hxx" 51cdf0e10cSrcweir #include "sdpage.hxx" 52cdf0e10cSrcweir #include "drawdoc.hxx" 53cdf0e10cSrcweir #include "drawview.hxx" 54cdf0e10cSrcweir #include "app.hrc" 55cdf0e10cSrcweir #include "strings.hrc" 56cdf0e10cSrcweir #include "glob.hrc" 57cdf0e10cSrcweir #include "ViewShellBase.hxx" 58cdf0e10cSrcweir #include "FactoryIds.hxx" 59cdf0e10cSrcweir 60cdf0e10cSrcweir // #110496# 61cdf0e10cSrcweir #include "slideshow.hxx" 62cdf0e10cSrcweir #include "fupoor.hxx" 63cdf0e10cSrcweir #include "Window.hxx" 64cdf0e10cSrcweir 65cdf0e10cSrcweir #define PresentationViewShell 66cdf0e10cSrcweir using namespace sd; 67cdf0e10cSrcweir #include "sdslots.hxx" 68cdf0e10cSrcweir 69cdf0e10cSrcweir using ::rtl::OUString; 70cdf0e10cSrcweir using namespace ::com::sun::star::uno; 71cdf0e10cSrcweir using namespace ::com::sun::star::lang; 72cdf0e10cSrcweir using namespace ::com::sun::star::beans; 73cdf0e10cSrcweir using namespace ::com::sun::star::presentation; 74cdf0e10cSrcweir 75cdf0e10cSrcweir namespace sd { 76cdf0e10cSrcweir 77cdf0e10cSrcweir // ------------------- 78cdf0e10cSrcweir // - PresentationViewShell - 79cdf0e10cSrcweir // ------------------- 80cdf0e10cSrcweir 81cdf0e10cSrcweir SFX_IMPL_INTERFACE( PresentationViewShell, DrawViewShell, SdResId( STR_PRESVIEWSHELL ) ) 82cdf0e10cSrcweir { 83cdf0e10cSrcweir SFX_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_TOOLS | SFX_VISIBILITY_STANDARD | 84cdf0e10cSrcweir SFX_VISIBILITY_FULLSCREEN | SFX_VISIBILITY_SERVER, 85cdf0e10cSrcweir SdResId(RID_DRAW_TOOLBOX)); 86cdf0e10cSrcweir SFX_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_APPLICATION | SFX_VISIBILITY_DESKTOP | SFX_VISIBILITY_STANDARD | SFX_VISIBILITY_CLIENT | SFX_VISIBILITY_VIEWER | SFX_VISIBILITY_READONLYDOC, 87cdf0e10cSrcweir SdResId(RID_DRAW_VIEWER_TOOLBOX) ); 88cdf0e10cSrcweir SFX_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_OPTIONS | SFX_VISIBILITY_STANDARD | 89cdf0e10cSrcweir SFX_VISIBILITY_SERVER, 90cdf0e10cSrcweir SdResId(RID_DRAW_OPTIONS_TOOLBOX)); 91cdf0e10cSrcweir SFX_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_COMMONTASK | SFX_VISIBILITY_STANDARD | 92cdf0e10cSrcweir SFX_VISIBILITY_SERVER, 93cdf0e10cSrcweir SdResId(RID_DRAW_COMMONTASK_TOOLBOX)); 94cdf0e10cSrcweir } 95cdf0e10cSrcweir 96cdf0e10cSrcweir 97cdf0e10cSrcweir TYPEINIT1( PresentationViewShell, DrawViewShell ); 98cdf0e10cSrcweir 99cdf0e10cSrcweir PresentationViewShell::PresentationViewShell( SfxViewFrame* pFrame, ViewShellBase& rViewShellBase, ::Window* pParentWindow, FrameView* pFrameView) 100cdf0e10cSrcweir : DrawViewShell( pFrame, rViewShellBase, pParentWindow, PK_STANDARD, pFrameView) 101cdf0e10cSrcweir { 102cdf0e10cSrcweir if( GetDocSh() && GetDocSh()->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED ) 103cdf0e10cSrcweir maOldVisArea = GetDocSh()->GetVisArea( ASPECT_CONTENT ); 104cdf0e10cSrcweir meShellType = ST_PRESENTATION; 105cdf0e10cSrcweir } 106cdf0e10cSrcweir 107cdf0e10cSrcweir PresentationViewShell::~PresentationViewShell (void) 108cdf0e10cSrcweir { 109cdf0e10cSrcweir if( GetDocSh() && GetDocSh()->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED && !maOldVisArea.IsEmpty() ) 110cdf0e10cSrcweir GetDocSh()->SetVisArea( maOldVisArea ); 111cdf0e10cSrcweir } 112cdf0e10cSrcweir 113cdf0e10cSrcweir void PresentationViewShell::FinishInitialization( FrameView* pFrameView ) 114cdf0e10cSrcweir { 115cdf0e10cSrcweir DrawViewShell::Init(true); 116cdf0e10cSrcweir 117cdf0e10cSrcweir // Use the frame view that comes form the view shell that initiated our 118cdf0e10cSrcweir // creation. 119cdf0e10cSrcweir if (pFrameView != NULL) 120cdf0e10cSrcweir { 121cdf0e10cSrcweir GetFrameView()->Disconnect(); 122cdf0e10cSrcweir SetFrameView (pFrameView); 123cdf0e10cSrcweir pFrameView->Connect(); 124cdf0e10cSrcweir } 125cdf0e10cSrcweir SetRuler(false); 126cdf0e10cSrcweir // SwitchPage (nPageNumber); 127cdf0e10cSrcweir WriteFrameViewData(); 128cdf0e10cSrcweir 129cdf0e10cSrcweir GetActiveWindow()->GrabFocus(); 130cdf0e10cSrcweir } 131cdf0e10cSrcweir 132cdf0e10cSrcweir 133cdf0e10cSrcweir SvxRuler* PresentationViewShell::CreateHRuler(::sd::Window*, sal_Bool) 134cdf0e10cSrcweir { 135cdf0e10cSrcweir return NULL; 136cdf0e10cSrcweir } 137cdf0e10cSrcweir 138cdf0e10cSrcweir SvxRuler* PresentationViewShell::CreateVRuler(::sd::Window*) 139cdf0e10cSrcweir { 140cdf0e10cSrcweir return NULL; 141cdf0e10cSrcweir } 142cdf0e10cSrcweir 143cdf0e10cSrcweir 144cdf0e10cSrcweir void PresentationViewShell::Activate( sal_Bool bIsMDIActivate ) 145cdf0e10cSrcweir { 146cdf0e10cSrcweir DrawViewShell::Activate( bIsMDIActivate ); 147cdf0e10cSrcweir 148cdf0e10cSrcweir if( bIsMDIActivate ) 149cdf0e10cSrcweir { 150cdf0e10cSrcweir //HMH::sd::View* pView = GetView(); 151cdf0e10cSrcweir SfxBoolItem aItem( SID_NAVIGATOR_INIT, sal_True ); 152cdf0e10cSrcweir 153cdf0e10cSrcweir GetViewFrame()->GetDispatcher()->Execute( SID_NAVIGATOR_INIT, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aItem, 0L ); 154cdf0e10cSrcweir 155cdf0e10cSrcweir rtl::Reference< SlideShow > xSlideShow( SlideShow::GetSlideShow( GetViewShellBase() ) ); 156cdf0e10cSrcweir if( xSlideShow.is() ) 157cdf0e10cSrcweir xSlideShow->activate(GetViewShellBase()); 158cdf0e10cSrcweir 159cdf0e10cSrcweir if( HasCurrentFunction() ) 160cdf0e10cSrcweir GetCurrentFunction()->Activate(); 161cdf0e10cSrcweir } 162cdf0e10cSrcweir 163cdf0e10cSrcweir if( bIsMDIActivate ) 164cdf0e10cSrcweir ReadFrameViewData( mpFrameView ); 165cdf0e10cSrcweir GetDocSh()->Connect( this ); 166cdf0e10cSrcweir } 167cdf0e10cSrcweir 168cdf0e10cSrcweir void PresentationViewShell::Paint( const Rectangle& rRect, ::sd::Window* ) 169cdf0e10cSrcweir { 170cdf0e10cSrcweir rtl::Reference< SlideShow > xSlideShow( SlideShow::GetSlideShow( GetViewShellBase() ) ); 171cdf0e10cSrcweir if( xSlideShow.is() ) 172cdf0e10cSrcweir xSlideShow->paint(rRect); 173cdf0e10cSrcweir } 174cdf0e10cSrcweir 175cdf0e10cSrcweir void PresentationViewShell::Resize (void) 176cdf0e10cSrcweir { 177cdf0e10cSrcweir ViewShell::Resize(); // do not call DrawViewShell here! 178cdf0e10cSrcweir 179cdf0e10cSrcweir rtl::Reference< sd::SlideShow > xSlideshow( SlideShow::GetSlideShow( GetViewShellBase() ) ); 180cdf0e10cSrcweir if( xSlideshow.is() ) 181cdf0e10cSrcweir xSlideshow->resize(maViewSize); 182cdf0e10cSrcweir } 183cdf0e10cSrcweir 184cdf0e10cSrcweir } // end of namespace sd 185