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