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