LibreOffice Module sd (master) 1
presvish.cxx
Go to the documentation of this file.
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/lang/XMultiServiceFactory.hpp>
21#include <com/sun/star/beans/XPropertySet.hpp>
22
24#include <sfx2/dispatch.hxx>
25#include <sfx2/objface.hxx>
26#include <sfx2/viewfrm.hxx>
27#include <svx/svxids.hrc>
28#include <svx/ruler.hxx>
29#include <FrameView.hxx>
30#include <DrawDocShell.hxx>
31#include <slideshow.hxx>
32#include <app.hrc>
33#include <ViewShellBase.hxx>
34
35#include <fupoor.hxx>
36#include <Window.hxx>
37
38#define ShellClass_PresentationViewShell
39using namespace sd;
40#include <sdslots.hxx>
41
42using namespace ::com::sun::star::uno;
43using namespace ::com::sun::star::lang;
44using namespace ::com::sun::star::beans;
45
46namespace sd {
47
49
50void PresentationViewShell::InitInterface_Impl()
51{
52 GetStaticInterface()->RegisterObjectBar(SFX_OBJECTBAR_TOOLS, SfxVisibilityFlags::Standard | SfxVisibilityFlags::FullScreen | SfxVisibilityFlags::Server,
53 ToolbarId::Draw_Toolbox_Sd);
54 GetStaticInterface()->RegisterObjectBar(SFX_OBJECTBAR_APPLICATION, SfxVisibilityFlags::Standard | SfxVisibilityFlags::Client | SfxVisibilityFlags::Viewer | SfxVisibilityFlags::ReadonlyDoc,
55 ToolbarId::Draw_Viewer_Toolbox);
56 GetStaticInterface()->RegisterObjectBar(SFX_OBJECTBAR_OPTIONS, SfxVisibilityFlags::Standard | SfxVisibilityFlags::Server,
57 ToolbarId::Draw_Options_Toolbox);
58 GetStaticInterface()->RegisterObjectBar(SFX_OBJECTBAR_COMMONTASK, SfxVisibilityFlags::Standard | SfxVisibilityFlags::Server,
59 ToolbarId::Draw_CommonTask_Toolbox);
60}
61
62
64 : DrawViewShell(rViewShellBase, pParentWindow, PageKind::Standard, pFrameView)
65 , mnAbortSlideShowEvent(nullptr)
66{
67 if( GetDocSh() && GetDocSh()->GetCreateMode() == SfxObjectCreateMode::EMBEDDED )
70}
71
73{
76
77 if( GetDocSh() && GetDocSh()->GetCreateMode() == SfxObjectCreateMode::EMBEDDED && !maOldVisArea.IsEmpty() )
79}
80
82{
84
85 // Use the frame view that comes form the view shell that initiated our
86 // creation.
87 if (pFrameView != nullptr)
88 {
90 SetFrameView (pFrameView);
91 pFrameView->Connect();
92 }
93 SetRuler(false);
95
97}
98
100{
101 return nullptr;
102}
103
105{
106 return nullptr;
107}
108
109IMPL_LINK_NOARG(PresentationViewShell, AbortSlideShowHdl, void*, void)
110{
111 mnAbortSlideShowEvent = nullptr;
112 rtl::Reference<SlideShow> xSlideShow(SlideShow::GetSlideShow(GetViewShellBase()));
113 if (xSlideShow.is())
114 xSlideShow->end();
115}
116
117void PresentationViewShell::Activate( bool bIsMDIActivate )
118{
119 DrawViewShell::Activate( bIsMDIActivate );
120
121 if( bIsMDIActivate )
122 {
123 SfxBoolItem aItem( SID_NAVIGATOR_INIT, true );
124
125 GetViewFrame()->GetDispatcher()->ExecuteList(SID_NAVIGATOR_INIT,
126 SfxCallMode::ASYNCHRON | SfxCallMode::RECORD, { &aItem });
127
129 if( xSlideShow.is() )
130 {
131 bool bSuccess = xSlideShow->activate(GetViewShellBase());
132 if (!bSuccess)
133 {
134 /* tdf#64711 PresentationViewShell is deleted by 'end' due to end closing
135 the object shell. So if we call xSlideShow->end during Activate there are
136 a lot of places in the call stack of Activate which understandable don't
137 expect this ViewShell to be deleted during use. Defer to the next event
138 loop the abort of the slideshow
139 */
142 }
143 }
144
145 if( HasCurrentFunction() )
146 GetCurrentFunction()->Activate();
147
149 }
150
151 GetDocSh()->Connect( this );
152}
153
154void PresentationViewShell::Paint( const ::tools::Rectangle& /*rRect*/, ::sd::Window* )
155{
157 if( xSlideShow.is() )
158 xSlideShow->paint();
159}
160
162{
163 ViewShell::Resize(); // do not call DrawViewShell here!
164
166 if( xSlideshow.is() )
167 xSlideshow->resize(maViewSize);
168}
169
170} // end of namespace sd
171
172/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static ImplSVEvent * PostUserEvent(const Link< void *, void > &rLink, void *pCaller=nullptr, bool bReferenceLink=false)
static void RemoveUserEvent(ImplSVEvent *nUserEvent)
const SfxPoolItem * ExecuteList(sal_uInt16 nSlot, SfxCallMode nCall, std::initializer_list< SfxPoolItem const * > args, std::initializer_list< SfxPoolItem const * > internalargs=std::initializer_list< SfxPoolItem const * >())
virtual void SetVisArea(const tools::Rectangle &rVisArea)
SfxDispatcher * GetDispatcher()
virtual ::tools::Rectangle GetVisArea(sal_uInt16 nAspect) const override
Definition: docshel2.cxx:120
void Connect(sd::ViewShell *pViewSh)
Definition: docshel2.cxx:147
Base class of the stacked shells that provide graphical views to Draw and Impress documents and editi...
virtual void Activate(bool bIsMDIActivate) override
set focus to working window
Definition: drviews1.cxx:79
virtual void WriteFrameViewData() override
Apply data of the current view on the FrameView.
Definition: drviews5.cxx:311
virtual void Init(bool bIsMainViewShell) override
The Init method has to be called from the outside directly after a new object of this class has been ...
Definition: drviewsa.cxx:348
virtual void ReadFrameViewData(FrameView *pView) override
Apply data of the FrameView on the current view.
Definition: drviews5.cxx:131
View for MDIFrame.
Definition: FrameView.hxx:36
void Connect()
Definition: frmview.cxx:256
void Disconnect()
Definition: frmview.cxx:261
This view shell is responsible for showing the presentation of an Impress document.
PresentationViewShell(ViewShellBase &rViewShellBase, vcl::Window *pParentWindow, FrameView *pFrameView)
Definition: presvish.cxx:63
virtual void Paint(const ::tools::Rectangle &rRect, ::sd::Window *pWin) override
The event is forwarded to the Viewshell and the current function by the window pWin.
Definition: presvish.cxx:154
virtual void Resize() override
Notify the view shell that its parent window has been resized.
Definition: presvish.cxx:161
virtual VclPtr< SvxRuler > CreateHRuler(::sd::Window *pWin) override
Generate horizontal ruler.
Definition: presvish.cxx:99
virtual VclPtr< SvxRuler > CreateVRuler(::sd::Window *pWin) override
Generate vertical ruler.
Definition: presvish.cxx:104
void FinishInitialization(FrameView *pFrameView)
This method is used by a simple class that passes some arguments from the creator of the new view she...
Definition: presvish.cxx:81
virtual void Activate(bool bIsMDIActivate) override
set focus to working window
Definition: presvish.cxx:117
virtual ~PresentationViewShell() override
Definition: presvish.cxx:72
static rtl::Reference< SlideShow > GetSlideShow(SdDrawDocument const *pDocument)
Definition: slideshow.cxx:157
SfxViewShell descendant that the stacked Draw/Impress shells are based on.
SD_DLLPUBLIC DrawDocShell * GetDocSh() const
Definition: viewshel.cxx:1407
const rtl::Reference< FuPoor > & GetCurrentFunction() const
Definition: ViewShell.hxx:250
FrameView * mpFrameView
Definition: ViewShell.hxx:453
ShellType meShellType
The type of the shell. Returned by GetShellType().
Definition: ViewShell.hxx:483
void SetRuler(bool bRuler)
Switch ruler on/off.
Definition: viewshe2.cxx:814
FrameView * GetFrameView()
Definition: ViewShell.hxx:221
::sd::Window * GetActiveWindow() const
The active window is usually the mpContentWindow.
Definition: ViewShell.hxx:155
void SetFrameView(FrameView *pFrameView)
Setting a frame view triggers ReadFrameViewData() for the new frame.
Definition: viewshe2.cxx:598
virtual void Resize()
Notify the view shell that its parent window has been resized.
Definition: viewshel.cxx:908
SD_DLLPUBLIC ViewShellBase & GetViewShellBase() const
Definition: viewshel.cxx:1397
SD_DLLPUBLIC SfxViewFrame * GetViewFrame() const
Definition: viewshel.cxx:118
bool HasCurrentFunction() const
Definition: ViewShell.hxx:252
An SdWindow contains the actual working area of ViewShell.
Definition: Window.hxx:45
void GrabFocus()
Activate window.
Definition: sdwindow.cxx:750
constexpr bool IsEmpty() const
IMPL_LINK_NOARG(MainSequence, onTimerHdl, Timer *, void)
#define SFX_OBJECTBAR_APPLICATION
#define SFX_OBJECTBAR_COMMONTASK
#define SFX_OBJECTBAR_OPTIONS
#define SFX_OBJECTBAR_TOOLS
#define ASPECT_CONTENT
PageKind
Definition: pres.hxx:45
#define SFX_IMPL_INTERFACE(Class, SuperClass)