1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 // MARKER(update_precomp.py): autogen include statement, do not remove 29 #include "precompiled_sd.hxx" 30 31 #include <com/sun/star/presentation/XSlideShowController.hpp> 32 33 #include <com/sun/star/lang/XMultiServiceFactory.hpp> 34 #include <com/sun/star/beans/XPropertySet.hpp> 35 #include <comphelper/processfactory.hxx> 36 37 #include "PresentationViewShell.hxx" 38 #include "optsitem.hxx" 39 #include "sddll.hxx" 40 #include <sfx2/request.hxx> 41 #ifndef _SFX_DISPATCH_HXX 42 #include <sfx2/dispatch.hxx> 43 #endif 44 45 #include <sfx2/objface.hxx> 46 47 #include <svx/svxids.hrc> 48 #ifndef SD_FRAME_VIEW 49 #include "FrameView.hxx" 50 #endif 51 #include "sdresid.hxx" 52 #include "DrawDocShell.hxx" 53 #include "slideshow.hxx" 54 #include "sdattr.hxx" 55 #include "sdpage.hxx" 56 #include "drawdoc.hxx" 57 #include "drawview.hxx" 58 #include "app.hrc" 59 #include "strings.hrc" 60 #include "glob.hrc" 61 #include "ViewShellBase.hxx" 62 #include "FactoryIds.hxx" 63 64 // #110496# 65 #include "slideshow.hxx" 66 #include "fupoor.hxx" 67 #include "Window.hxx" 68 69 #define PresentationViewShell 70 using namespace sd; 71 #include "sdslots.hxx" 72 73 using ::rtl::OUString; 74 using namespace ::com::sun::star::uno; 75 using namespace ::com::sun::star::lang; 76 using namespace ::com::sun::star::beans; 77 using namespace ::com::sun::star::presentation; 78 79 namespace sd { 80 81 // ------------------- 82 // - PresentationViewShell - 83 // ------------------- 84 85 SFX_IMPL_INTERFACE( PresentationViewShell, DrawViewShell, SdResId( STR_PRESVIEWSHELL ) ) 86 { 87 SFX_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_TOOLS | SFX_VISIBILITY_STANDARD | 88 SFX_VISIBILITY_FULLSCREEN | SFX_VISIBILITY_SERVER, 89 SdResId(RID_DRAW_TOOLBOX)); 90 SFX_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_APPLICATION | SFX_VISIBILITY_DESKTOP | SFX_VISIBILITY_STANDARD | SFX_VISIBILITY_CLIENT | SFX_VISIBILITY_VIEWER | SFX_VISIBILITY_READONLYDOC, 91 SdResId(RID_DRAW_VIEWER_TOOLBOX) ); 92 SFX_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_OPTIONS | SFX_VISIBILITY_STANDARD | 93 SFX_VISIBILITY_SERVER, 94 SdResId(RID_DRAW_OPTIONS_TOOLBOX)); 95 SFX_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_COMMONTASK | SFX_VISIBILITY_STANDARD | 96 SFX_VISIBILITY_SERVER, 97 SdResId(RID_DRAW_COMMONTASK_TOOLBOX)); 98 } 99 100 101 TYPEINIT1( PresentationViewShell, DrawViewShell ); 102 103 PresentationViewShell::PresentationViewShell( SfxViewFrame* pFrame, ViewShellBase& rViewShellBase, ::Window* pParentWindow, FrameView* pFrameView) 104 : DrawViewShell( pFrame, rViewShellBase, pParentWindow, PK_STANDARD, pFrameView) 105 { 106 if( GetDocSh() && GetDocSh()->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED ) 107 maOldVisArea = GetDocSh()->GetVisArea( ASPECT_CONTENT ); 108 meShellType = ST_PRESENTATION; 109 } 110 111 PresentationViewShell::~PresentationViewShell (void) 112 { 113 if( GetDocSh() && GetDocSh()->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED && !maOldVisArea.IsEmpty() ) 114 GetDocSh()->SetVisArea( maOldVisArea ); 115 } 116 117 void PresentationViewShell::FinishInitialization( FrameView* pFrameView ) 118 { 119 DrawViewShell::Init(true); 120 121 // Use the frame view that comes form the view shell that initiated our 122 // creation. 123 if (pFrameView != NULL) 124 { 125 GetFrameView()->Disconnect(); 126 SetFrameView (pFrameView); 127 pFrameView->Connect(); 128 } 129 SetRuler(false); 130 // SwitchPage (nPageNumber); 131 WriteFrameViewData(); 132 133 GetActiveWindow()->GrabFocus(); 134 } 135 136 137 SvxRuler* PresentationViewShell::CreateHRuler(::sd::Window*, sal_Bool) 138 { 139 return NULL; 140 } 141 142 SvxRuler* PresentationViewShell::CreateVRuler(::sd::Window*) 143 { 144 return NULL; 145 } 146 147 148 void PresentationViewShell::Activate( sal_Bool bIsMDIActivate ) 149 { 150 DrawViewShell::Activate( bIsMDIActivate ); 151 152 if( bIsMDIActivate ) 153 { 154 //HMH::sd::View* pView = GetView(); 155 SfxBoolItem aItem( SID_NAVIGATOR_INIT, sal_True ); 156 157 GetViewFrame()->GetDispatcher()->Execute( SID_NAVIGATOR_INIT, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aItem, 0L ); 158 159 rtl::Reference< SlideShow > xSlideShow( SlideShow::GetSlideShow( GetViewShellBase() ) ); 160 if( xSlideShow.is() ) 161 xSlideShow->activate(GetViewShellBase()); 162 163 if( HasCurrentFunction() ) 164 GetCurrentFunction()->Activate(); 165 } 166 167 if( bIsMDIActivate ) 168 ReadFrameViewData( mpFrameView ); 169 GetDocSh()->Connect( this ); 170 } 171 172 void PresentationViewShell::Paint( const Rectangle& rRect, ::sd::Window* ) 173 { 174 rtl::Reference< SlideShow > xSlideShow( SlideShow::GetSlideShow( GetViewShellBase() ) ); 175 if( xSlideShow.is() ) 176 xSlideShow->paint(rRect); 177 } 178 179 void PresentationViewShell::Resize (void) 180 { 181 ViewShell::Resize(); // do not call DrawViewShell here! 182 183 rtl::Reference< sd::SlideShow > xSlideshow( SlideShow::GetSlideShow( GetViewShellBase() ) ); 184 if( xSlideshow.is() ) 185 xSlideshow->resize(maViewSize); 186 } 187 188 } // end of namespace sd 189