Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 :
21 : #include <com/sun/star/presentation/XSlideShowController.hpp>
22 :
23 : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
24 : #include <com/sun/star/beans/XPropertySet.hpp>
25 : #include <comphelper/processfactory.hxx>
26 :
27 : #include "PresentationViewShell.hxx"
28 : #include "optsitem.hxx"
29 : #include "sddll.hxx"
30 : #include <sfx2/request.hxx>
31 : #include <sfx2/dispatch.hxx>
32 :
33 : #include <sfx2/objface.hxx>
34 :
35 : #include <svx/svxids.hrc>
36 : #ifndef SD_FRAME_VIEW
37 : #include "FrameView.hxx"
38 : #endif
39 : #include "sdresid.hxx"
40 : #include "DrawDocShell.hxx"
41 : #include "slideshow.hxx"
42 : #include "sdattr.hxx"
43 : #include "sdpage.hxx"
44 : #include "drawdoc.hxx"
45 : #include "drawview.hxx"
46 : #include "app.hrc"
47 : #include "strings.hrc"
48 : #include "glob.hrc"
49 : #include "ViewShellBase.hxx"
50 : #include "FactoryIds.hxx"
51 :
52 : #include "fupoor.hxx"
53 : #include "Window.hxx"
54 :
55 : #define PresentationViewShell
56 : using namespace sd;
57 : #include "sdslots.hxx"
58 :
59 : using namespace ::com::sun::star::uno;
60 : using namespace ::com::sun::star::lang;
61 : using namespace ::com::sun::star::beans;
62 : using namespace ::com::sun::star::presentation;
63 :
64 : namespace sd {
65 :
66 : // -------------------
67 : // - PresentationViewShell -
68 : // -------------------
69 :
70 77 : SFX_IMPL_INTERFACE( PresentationViewShell, DrawViewShell, SdResId( STR_PRESVIEWSHELL ) )
71 : {
72 22 : SFX_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_TOOLS | SFX_VISIBILITY_STANDARD |
73 : SFX_VISIBILITY_FULLSCREEN | SFX_VISIBILITY_SERVER,
74 11 : SdResId(RID_DRAW_TOOLBOX));
75 22 : SFX_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_APPLICATION | SFX_VISIBILITY_DESKTOP | SFX_VISIBILITY_STANDARD | SFX_VISIBILITY_CLIENT | SFX_VISIBILITY_VIEWER | SFX_VISIBILITY_READONLYDOC,
76 11 : SdResId(RID_DRAW_VIEWER_TOOLBOX) );
77 22 : SFX_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_OPTIONS | SFX_VISIBILITY_STANDARD |
78 : SFX_VISIBILITY_SERVER,
79 11 : SdResId(RID_DRAW_OPTIONS_TOOLBOX));
80 22 : SFX_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_COMMONTASK | SFX_VISIBILITY_STANDARD |
81 : SFX_VISIBILITY_SERVER,
82 11 : SdResId(RID_DRAW_COMMONTASK_TOOLBOX));
83 11 : }
84 :
85 :
86 65 : TYPEINIT1( PresentationViewShell, DrawViewShell );
87 :
88 0 : PresentationViewShell::PresentationViewShell( SfxViewFrame* pFrame, ViewShellBase& rViewShellBase, ::Window* pParentWindow, FrameView* pFrameView)
89 0 : : DrawViewShell( pFrame, rViewShellBase, pParentWindow, PK_STANDARD, pFrameView)
90 : {
91 0 : if( GetDocSh() && GetDocSh()->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED )
92 0 : maOldVisArea = GetDocSh()->GetVisArea( ASPECT_CONTENT );
93 0 : meShellType = ST_PRESENTATION;
94 0 : }
95 :
96 0 : PresentationViewShell::~PresentationViewShell (void)
97 : {
98 0 : if( GetDocSh() && GetDocSh()->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED && !maOldVisArea.IsEmpty() )
99 0 : GetDocSh()->SetVisArea( maOldVisArea );
100 0 : }
101 :
102 0 : void PresentationViewShell::FinishInitialization( FrameView* pFrameView )
103 : {
104 0 : DrawViewShell::Init(true);
105 :
106 : // Use the frame view that comes form the view shell that initiated our
107 : // creation.
108 0 : if (pFrameView != NULL)
109 : {
110 0 : GetFrameView()->Disconnect();
111 0 : SetFrameView (pFrameView);
112 0 : pFrameView->Connect();
113 : }
114 0 : SetRuler(false);
115 0 : WriteFrameViewData();
116 :
117 0 : GetActiveWindow()->GrabFocus();
118 0 : }
119 :
120 :
121 0 : SvxRuler* PresentationViewShell::CreateHRuler(::sd::Window*, sal_Bool)
122 : {
123 0 : return NULL;
124 : }
125 :
126 0 : SvxRuler* PresentationViewShell::CreateVRuler(::sd::Window*)
127 : {
128 0 : return NULL;
129 : }
130 :
131 :
132 0 : void PresentationViewShell::Activate( sal_Bool bIsMDIActivate )
133 : {
134 0 : DrawViewShell::Activate( bIsMDIActivate );
135 :
136 0 : if( bIsMDIActivate )
137 : {
138 0 : SfxBoolItem aItem( SID_NAVIGATOR_INIT, sal_True );
139 :
140 0 : GetViewFrame()->GetDispatcher()->Execute( SID_NAVIGATOR_INIT, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aItem, 0L );
141 :
142 0 : rtl::Reference< SlideShow > xSlideShow( SlideShow::GetSlideShow( GetViewShellBase() ) );
143 0 : if( xSlideShow.is() )
144 0 : xSlideShow->activate(GetViewShellBase());
145 :
146 0 : if( HasCurrentFunction() )
147 0 : GetCurrentFunction()->Activate();
148 : }
149 :
150 0 : if( bIsMDIActivate )
151 0 : ReadFrameViewData( mpFrameView );
152 0 : GetDocSh()->Connect( this );
153 0 : }
154 :
155 0 : void PresentationViewShell::Paint( const Rectangle& rRect, ::sd::Window* )
156 : {
157 0 : rtl::Reference< SlideShow > xSlideShow( SlideShow::GetSlideShow( GetViewShellBase() ) );
158 0 : if( xSlideShow.is() )
159 0 : xSlideShow->paint(rRect);
160 0 : }
161 :
162 0 : void PresentationViewShell::Resize (void)
163 : {
164 0 : ViewShell::Resize(); // do not call DrawViewShell here!
165 :
166 0 : rtl::Reference< sd::SlideShow > xSlideshow( SlideShow::GetSlideShow( GetViewShellBase() ) );
167 0 : if( xSlideshow.is() )
168 0 : xSlideshow->resize(maViewSize);
169 0 : }
170 :
171 33 : } // end of namespace sd
172 :
173 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|