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 ::rtl::OUString;
60 : using namespace ::com::sun::star::uno;
61 : using namespace ::com::sun::star::lang;
62 : using namespace ::com::sun::star::beans;
63 : using namespace ::com::sun::star::presentation;
64 :
65 : namespace sd {
66 :
67 : // -------------------
68 : // - PresentationViewShell -
69 : // -------------------
70 :
71 21 : SFX_IMPL_INTERFACE( PresentationViewShell, DrawViewShell, SdResId( STR_PRESVIEWSHELL ) )
72 : {
73 6 : SFX_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_TOOLS | SFX_VISIBILITY_STANDARD |
74 : SFX_VISIBILITY_FULLSCREEN | SFX_VISIBILITY_SERVER,
75 3 : SdResId(RID_DRAW_TOOLBOX));
76 6 : SFX_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_APPLICATION | SFX_VISIBILITY_DESKTOP | SFX_VISIBILITY_STANDARD | SFX_VISIBILITY_CLIENT | SFX_VISIBILITY_VIEWER | SFX_VISIBILITY_READONLYDOC,
77 3 : SdResId(RID_DRAW_VIEWER_TOOLBOX) );
78 6 : SFX_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_OPTIONS | SFX_VISIBILITY_STANDARD |
79 : SFX_VISIBILITY_SERVER,
80 3 : SdResId(RID_DRAW_OPTIONS_TOOLBOX));
81 6 : SFX_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_COMMONTASK | SFX_VISIBILITY_STANDARD |
82 : SFX_VISIBILITY_SERVER,
83 3 : SdResId(RID_DRAW_COMMONTASK_TOOLBOX));
84 3 : }
85 :
86 :
87 0 : TYPEINIT1( PresentationViewShell, DrawViewShell );
88 :
89 0 : PresentationViewShell::PresentationViewShell( SfxViewFrame* pFrame, ViewShellBase& rViewShellBase, ::Window* pParentWindow, FrameView* pFrameView)
90 0 : : DrawViewShell( pFrame, rViewShellBase, pParentWindow, PK_STANDARD, pFrameView)
91 : {
92 0 : if( GetDocSh() && GetDocSh()->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED )
93 0 : maOldVisArea = GetDocSh()->GetVisArea( ASPECT_CONTENT );
94 0 : meShellType = ST_PRESENTATION;
95 0 : }
96 :
97 0 : PresentationViewShell::~PresentationViewShell (void)
98 : {
99 0 : if( GetDocSh() && GetDocSh()->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED && !maOldVisArea.IsEmpty() )
100 0 : GetDocSh()->SetVisArea( maOldVisArea );
101 0 : }
102 :
103 0 : void PresentationViewShell::FinishInitialization( FrameView* pFrameView )
104 : {
105 0 : DrawViewShell::Init(true);
106 :
107 : // Use the frame view that comes form the view shell that initiated our
108 : // creation.
109 0 : if (pFrameView != NULL)
110 : {
111 0 : GetFrameView()->Disconnect();
112 0 : SetFrameView (pFrameView);
113 0 : pFrameView->Connect();
114 : }
115 0 : SetRuler(false);
116 0 : WriteFrameViewData();
117 :
118 0 : GetActiveWindow()->GrabFocus();
119 0 : }
120 :
121 :
122 0 : SvxRuler* PresentationViewShell::CreateHRuler(::sd::Window*, sal_Bool)
123 : {
124 0 : return NULL;
125 : }
126 :
127 0 : SvxRuler* PresentationViewShell::CreateVRuler(::sd::Window*)
128 : {
129 0 : return NULL;
130 : }
131 :
132 :
133 0 : void PresentationViewShell::Activate( sal_Bool bIsMDIActivate )
134 : {
135 0 : DrawViewShell::Activate( bIsMDIActivate );
136 :
137 0 : if( bIsMDIActivate )
138 : {
139 0 : SfxBoolItem aItem( SID_NAVIGATOR_INIT, sal_True );
140 :
141 0 : GetViewFrame()->GetDispatcher()->Execute( SID_NAVIGATOR_INIT, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aItem, 0L );
142 :
143 0 : rtl::Reference< SlideShow > xSlideShow( SlideShow::GetSlideShow( GetViewShellBase() ) );
144 0 : if( xSlideShow.is() )
145 0 : xSlideShow->activate(GetViewShellBase());
146 :
147 0 : if( HasCurrentFunction() )
148 0 : GetCurrentFunction()->Activate();
149 : }
150 :
151 0 : if( bIsMDIActivate )
152 0 : ReadFrameViewData( mpFrameView );
153 0 : GetDocSh()->Connect( this );
154 0 : }
155 :
156 0 : void PresentationViewShell::Paint( const Rectangle& rRect, ::sd::Window* )
157 : {
158 0 : rtl::Reference< SlideShow > xSlideShow( SlideShow::GetSlideShow( GetViewShellBase() ) );
159 0 : if( xSlideShow.is() )
160 0 : xSlideShow->paint(rRect);
161 0 : }
162 :
163 0 : void PresentationViewShell::Resize (void)
164 : {
165 0 : ViewShell::Resize(); // do not call DrawViewShell here!
166 :
167 0 : rtl::Reference< sd::SlideShow > xSlideshow( SlideShow::GetSlideShow( GetViewShellBase() ) );
168 0 : if( xSlideshow.is() )
169 0 : xSlideshow->resize(maViewSize);
170 0 : }
171 :
172 9 : } // end of namespace sd
173 :
174 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|