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