LibreOffice Module sd (master) 1
slideshowimpl.hxx
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#pragma once
21
22#include <memory>
23#include <sal/config.h>
27#include <com/sun/star/presentation/ClickAction.hpp>
28#include <com/sun/star/presentation/XSlideShowNavigationListener.hpp>
29#include <com/sun/star/presentation/XSlideShowController.hpp>
30#include <com/sun/star/presentation/XShapeEventListener.hpp>
31
32#include <drawdoc.hxx>
33
34#include "showwindow.hxx"
35
36#include <slideshow.hxx>
37
38namespace com::sun::star::frame { class XModel; }
39namespace com::sun::star::media { class XPlayer; }
40namespace sd { class DrawDocShell; }
41namespace sd { class ViewShell; }
42
43class SfxBindings;
44class SfxDispatcher;
45class SfxViewFrame;
46class StarBASIC;
47
48namespace sd
49{
50class SlideShowView;
51class AnimationSlideController;
52class PaneHider;
53
55{
59 css::uno::Reference< css::drawing::XDrawPage > mxStartPage;
60 css::uno::Reference< css::animations::XAnimationNode > mxAnimationNode;
61
64
66 void SetArguments( const css::uno::Sequence< css::beans::PropertyValue >& rArguments );
67
69 void SetPropertyValue( std::u16string_view rProperty, const css::uno::Any& rValue );
70};
71
73{
74 css::presentation::ClickAction meClickAction;
75 sal_Int32 mnVerb;
76 OUString maStrBookmark;
77 WrappedShapeEventImpl() : meClickAction( css::presentation::ClickAction_NONE ), mnVerb( 0 ) {};
78};
79
80typedef std::shared_ptr< WrappedShapeEventImpl > WrappedShapeEventImplPtr;
81
83 public ::cppu::WeakImplHelper< css::presentation::XSlideShowNavigationListener, css::presentation::XShapeEventListener >
84{
85public:
86 SlideShowListenerProxy( rtl::Reference< SlideshowImpl > xController, css::uno::Reference< css::presentation::XSlideShow > xSlideShow );
87 virtual ~SlideShowListenerProxy() override;
88
91
92 void addSlideShowListener( const css::uno::Reference< css::presentation::XSlideShowListener >& Listener );
93 void removeSlideShowListener( const css::uno::Reference< css::presentation::XSlideShowListener >& Listener );
94
95 void addShapeEventListener( const css::uno::Reference< css::drawing::XShape >& xShape );
96 void removeShapeEventListener( const css::uno::Reference< css::drawing::XShape >& xShape );
97
98 // css::animations::XAnimationListener
99 virtual void SAL_CALL beginEvent( const css::uno::Reference< css::animations::XAnimationNode >& Node ) override;
100 virtual void SAL_CALL endEvent( const css::uno::Reference< css::animations::XAnimationNode >& Node ) override;
101 virtual void SAL_CALL repeat( const css::uno::Reference< css::animations::XAnimationNode >& Node, ::sal_Int32 Repeat ) override;
102
103 // css::presentation::XSlideShowListener:
104 virtual void SAL_CALL paused() override;
105 virtual void SAL_CALL resumed() override;
106 virtual void SAL_CALL slideTransitionStarted() override;
107 virtual void SAL_CALL slideTransitionEnded() override;
108 virtual void SAL_CALL slideAnimationsEnded() override;
109 virtual void SAL_CALL slideEnded(sal_Bool bReverse) override;
110 virtual void SAL_CALL hyperLinkClicked(const OUString & hyperLink) override;
111
112 // css::presentation::XSlideShowNavigationListener:
113 virtual void SAL_CALL contextMenuShow(const css::awt::Point& point) override;
114
115 // css::lang::XEventListener:
116 virtual void SAL_CALL disposing(const css::lang::EventObject & Source) override;
117
118 // css::presentation::XShapeEventListener:
119 virtual void SAL_CALL click(const css::uno::Reference< css::drawing::XShape > & xShape, const css::awt::MouseEvent & aOriginalEvent) override;
120
121private:
122 std::mutex m_aMutex;
125 css::uno::Reference< css::presentation::XSlideShow > mxSlideShow;
126};
127
129
131{
132friend class SlideShow;
133friend class SlideShowView;
134
135public:
136 explicit SlideshowImpl( const css::uno::Reference< css::presentation::XPresentation2 >& xPresentation, ViewShell* pViewSh, ::sd::View* pView, SdDrawDocument* pDoc, vcl::Window* pParentWindow);
137
138 // css::presentation::XSlideShowController:
139 virtual sal_Bool SAL_CALL getAlwaysOnTop() override;
140 virtual void SAL_CALL setAlwaysOnTop( sal_Bool _alwaysontop ) override;
141 virtual sal_Bool SAL_CALL getMouseVisible() override;
142 virtual void SAL_CALL setMouseVisible( sal_Bool _mousevisible ) override;
143 virtual sal_Bool SAL_CALL getUsePen() override;
144 virtual void SAL_CALL setUsePen( sal_Bool _usepen ) override;
145 virtual ::sal_Int32 SAL_CALL getPenColor() override;
146 virtual void SAL_CALL setPenColor( ::sal_Int32 _pencolor ) override;
147 virtual double SAL_CALL getPenWidth() override;
148 virtual void SAL_CALL setPenWidth( double dStrokeWidth ) override;
150 virtual void SAL_CALL setEraseAllInk( sal_Bool bEraseAllInk ) override;
151 virtual sal_Bool SAL_CALL isRunning( ) override;
152 virtual ::sal_Int32 SAL_CALL getSlideCount( ) override;
153 virtual css::uno::Reference< css::drawing::XDrawPage > SAL_CALL getSlideByIndex( ::sal_Int32 Index ) override;
154 virtual void SAL_CALL addSlideShowListener( const css::uno::Reference< css::presentation::XSlideShowListener >& Listener ) override;
155 virtual void SAL_CALL removeSlideShowListener( const css::uno::Reference< css::presentation::XSlideShowListener >& Listener ) override;
156 virtual void SAL_CALL gotoNextEffect( ) override;
157 virtual void SAL_CALL gotoPreviousEffect( ) override;
158 virtual void SAL_CALL gotoFirstSlide( ) override;
159 virtual void SAL_CALL gotoNextSlide( ) override;
160 virtual void SAL_CALL gotoPreviousSlide( ) override;
161 virtual void SAL_CALL gotoLastSlide( ) override;
162 virtual void SAL_CALL gotoBookmark( const OUString& Bookmark ) override;
163 virtual void SAL_CALL gotoSlide( const css::uno::Reference< css::drawing::XDrawPage >& Page ) override;
164 virtual void SAL_CALL gotoSlideIndex( ::sal_Int32 Index ) override;
165 virtual void SAL_CALL stopSound( ) override;
166 virtual void SAL_CALL pause( ) override;
167 virtual void SAL_CALL resume( ) override;
168 virtual sal_Bool SAL_CALL isPaused( ) override;
169 virtual void SAL_CALL blankScreen( ::sal_Int32 Color ) override;
170 virtual void SAL_CALL activate( ) override;
171 virtual void SAL_CALL deactivate( ) override;
172 virtual sal_Bool SAL_CALL isActive( ) override;
173 virtual css::uno::Reference< css::drawing::XDrawPage > SAL_CALL getCurrentSlide( ) override;
174 virtual ::sal_Int32 SAL_CALL getCurrentSlideIndex( ) override;
175 virtual ::sal_Int32 SAL_CALL getNextSlideIndex( ) override;
176 virtual sal_Bool SAL_CALL isEndless( ) override;
177 virtual sal_Bool SAL_CALL isFullScreen( ) override;
178 virtual css::uno::Reference< css::presentation::XSlideShow > SAL_CALL getSlideShow( ) override;
179
180 // XIndexAccess
181 virtual ::sal_Int32 SAL_CALL getCount( ) override;
182 virtual css::uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) override;
183 virtual css::uno::Type SAL_CALL getElementType( ) override;
184 virtual sal_Bool SAL_CALL hasElements( ) override;
185
186 // will be called from the SlideShowListenerProxy when this event is fired from the XSlideShow
187 void slideEnded(const bool bReverse);
188 void contextMenuShow(const css::awt::Point& point);
190 void hyperLinkClicked(const OUString & hyperLink);
191 void click(const css::uno::Reference< css::drawing::XShape > & xShape);
192 bool swipe(const CommandGestureSwipeData &rSwipeData);
193 bool longpress(const CommandGestureLongPressData& rLongPressData);
194
196 void endPresentation();
197
198 ViewShell* getViewShell() const { return mpViewShell; }
199
200 void paint();
201 bool keyInput(const KeyEvent& rKEvt);
202 void mouseButtonUp(const MouseEvent& rMEvt);
203
204private:
205 SlideshowImpl(SlideshowImpl const &) = delete;
206 void operator =(SlideshowImpl const &) = delete;
207
208 virtual ~SlideshowImpl() override;
209
210 // override WeakComponentImplHelperBase::disposing()
211 // This function is called upon disposing the component,
212 // if your component needs special work when it becomes
213 // disposed, do it here.
214 virtual void disposing(std::unique_lock<std::mutex>&) override;
215
216 // internal
217 bool startShow( PresentationSettingsEx const * pPresSettings );
218 bool startPreview(
219 const css::uno::Reference< css::drawing::XDrawPage >& xDrawPage,
220 const css::uno::Reference< css::animations::XAnimationNode >& xAnimationNode,
221 vcl::Window* pParent );
222
224 void startUpdateTimer();
225
226 void update();
227
228 void createSlideList( bool bAll, std::u16string_view rPresSlide );
229
230 void displayCurrentSlide (const bool bSkipAllMainSequenceEffects = false);
231
232 void displaySlideNumber( sal_Int32 nSlide );
233 void displaySlideIndex( sal_Int32 nIndex );
234 sal_Int32 getCurrentSlideNumber() const;
235 bool isInputFreezed() const { return mbInputFreeze; }
236
237 void jumpToBookmark( const OUString& sBookmark );
238
239 void hideChildWindows();
240 void showChildWindows();
241
242 void resize( const Size& rSize );
243
244 void setActiveXToolbarsVisible( bool bVisible );
245
246 DECL_LINK( updateHdl, Timer *, void );
247 DECL_LINK( ReadyForNextInputHdl, Timer *, void );
248 DECL_LINK( endPresentationHdl, void*, void );
249 void ContextMenuSelectHdl(std::u16string_view rIdent);
250 DECL_LINK( ContextMenuHdl, void*, void );
251 DECL_LINK( deactivateHdl, Timer *, void );
252 DECL_LINK( EventListenerHdl, VclSimpleEvent&, void );
253
256 void onFirstPaint();
257
259
260private:
261 bool startShowImpl(
262 const css::uno::Sequence< css::beans::PropertyValue >& aProperties );
263
264 SfxViewFrame* getViewFrame() const;
266 SfxBindings* getBindings() const;
267
268 sal_Int32 getSlideNumberForBookmark( const OUString& rStrBookmark );
269
270 void removeShapeEvents();
271 void registerShapeEvents( sal_Int32 nSlideNumber );
273 void registerShapeEvents( css::uno::Reference< css::drawing::XShapes > const & xShapes );
274
275 static css::uno::Reference< css::presentation::XSlideShow > createSlideShow();
276
277 static void setAutoSaveState( bool bOn );
278 void gotoPreviousSlide (const bool bSkipAllMainSequenceEffects);
279
285 void updateSlideShow();
286
287 css::uno::Reference< css::presentation::XSlideShow > mxShow;
289 css::uno::Reference< css::frame::XModel > mxModel;
290
294
299
302
303 std::shared_ptr< AnimationSlideController > mpSlideController;
304
309 OUString maCharBuffer;
317 bool mbWasPaused; // used to cache pause state during context menu
320
323
326
327 std::map< css::uno::Reference< css::drawing::XShape >, WrappedShapeEventImplPtr >
329
330 css::uno::Reference< css::drawing::XDrawPage > mxPreviewDrawPage;
331 css::uno::Reference< css::animations::XAnimationNode > mxPreviewAnimationNode;
332
333 css::uno::Reference< css::media::XPlayer > mxPlayer;
334
335 ::std::unique_ptr<PaneHider> mpPaneHider;
336
339
340 css::uno::Reference< css::presentation::XPresentation2 > mxPresentation;
342};
343
344} // namespace ::sd
345
346/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
struct _ADOIndex Index
Slide show listener.
Definition: Listener.hxx:29
void removeShapeEventListener(const css::uno::Reference< css::drawing::XShape > &xShape)
virtual void SAL_CALL disposing(const css::lang::EventObject &Source) override
virtual void SAL_CALL click(const css::uno::Reference< css::drawing::XShape > &xShape, const css::awt::MouseEvent &aOriginalEvent) override
virtual void SAL_CALL slideAnimationsEnded() override
virtual void SAL_CALL slideTransitionEnded() override
virtual void SAL_CALL slideTransitionStarted() override
virtual void SAL_CALL beginEvent(const css::uno::Reference< css::animations::XAnimationNode > &Node) override
rtl::Reference< SlideshowImpl > mxController
virtual void SAL_CALL paused() override
SlideShowListenerProxy(rtl::Reference< SlideshowImpl > xController, css::uno::Reference< css::presentation::XSlideShow > xSlideShow)
virtual ~SlideShowListenerProxy() override
virtual void SAL_CALL slideEnded(sal_Bool bReverse) override
virtual void SAL_CALL resumed() override
void removeSlideShowListener(const css::uno::Reference< css::presentation::XSlideShowListener > &Listener)
virtual void SAL_CALL contextMenuShow(const css::awt::Point &point) override
void addShapeEventListener(const css::uno::Reference< css::drawing::XShape > &xShape)
css::uno::Reference< css::presentation::XSlideShow > mxSlideShow
virtual void SAL_CALL hyperLinkClicked(const OUString &hyperLink) override
virtual void SAL_CALL endEvent(const css::uno::Reference< css::animations::XAnimationNode > &Node) override
virtual void SAL_CALL repeat(const css::uno::Reference< css::animations::XAnimationNode > &Node, ::sal_Int32 Repeat) override
void addSlideShowListener(const css::uno::Reference< css::presentation::XSlideShowListener > &Listener)
::comphelper::OInterfaceContainerHelper4< css::presentation::XSlideShowListener > maListeners
virtual void SAL_CALL setPenColor(::sal_Int32 _pencolor) override
void displaySlideIndex(sal_Int32 nIndex)
nSlideIndex == -1 displays current slide again
SlideshowImpl(const css::uno::Reference< css::presentation::XPresentation2 > &xPresentation, ViewShell *pViewSh, ::sd::View *pView, SdDrawDocument *pDoc, vcl::Window *pParentWindow)
::tools::Long getRestoreSlide() const
virtual void SAL_CALL gotoBookmark(const OUString &Bookmark) override
css::uno::Reference< css::animations::XAnimationNode > mxPreviewAnimationNode
DECL_LINK(updateHdl, Timer *, void)
virtual void SAL_CALL removeSlideShowListener(const css::uno::Reference< css::presentation::XSlideShowListener > &Listener) override
void jumpToBookmark(const OUString &sBookmark)
css::uno::Reference< css::presentation::XPresentation2 > mxPresentation
virtual sal_Bool SAL_CALL getAlwaysOnTop() override
::std::unique_ptr< PaneHider > mpPaneHider
::rtl::Reference< SlideShowListenerProxy > mxListenerProxy
ViewShell * getViewShell() const
DECL_LINK(ContextMenuHdl, void *, void)
static void setAutoSaveState(bool bOn)
virtual void SAL_CALL stopSound() override
void displaySlideNumber(sal_Int32 nSlide)
virtual sal_Bool SAL_CALL isActive() override
void registerShapeEvents(css::uno::Reference< css::drawing::XShapes > const &xShapes)
void onFirstPaint()
called only by the slideshow view when the first paint event occurs.
virtual void SAL_CALL blankScreen(::sal_Int32 Color) override
bool startShowImpl(const css::uno::Sequence< css::beans::PropertyValue > &aProperties)
css::uno::Reference< css::drawing::XDrawPage > mxPreviewDrawPage
VclPtr< sd::ShowWindow > mpShowWindow
sal_Int32 getSlideNumberForBookmark(const OUString &rStrBookmark)
virtual sal_Bool SAL_CALL getUsePen() override
::tools::Long mnRestoreSlide
virtual void SAL_CALL gotoNextEffect() override
void registerShapeEvents(sal_Int32 nSlideNumber)
void displayCurrentSlide(const bool bSkipAllMainSequenceEffects=false)
SlideshowImpl(SlideshowImpl const &)=delete
std::shared_ptr< AnimationSlideController > mpSlideController
virtual css::uno::Reference< css::drawing::XDrawPage > SAL_CALL getSlideByIndex(::sal_Int32 Index) override
VclPtr< ::sd::Window > mpOldActiveWindow
DECL_LINK(ReadyForNextInputHdl, Timer *, void)
virtual void SAL_CALL gotoPreviousEffect() override
static css::uno::Reference< css::presentation::XSlideShow > createSlideShow()
DECL_LINK(EventListenerHdl, VclSimpleEvent &, void)
SfxBindings * getBindings() const
void resize(const Size &rSize)
ImplSVEvent * mnEndShowEvent
virtual void SAL_CALL setPenWidth(double dStrokeWidth) override
virtual void SAL_CALL setEraseAllInk(sal_Bool bEraseAllInk) override
void mouseButtonUp(const MouseEvent &rMEvt)
void startUpdateTimer()
forces an async call to update in the main thread
virtual sal_Bool SAL_CALL hasElements() override
DECL_LINK(deactivateHdl, Timer *, void)
::sd::View * mpView
void hyperLinkClicked(const OUString &hyperLink)
virtual sal_Bool SAL_CALL isEndless() override
virtual css::uno::Reference< css::presentation::XSlideShow > SAL_CALL getSlideShow() override
bool startShow(PresentationSettingsEx const *pPresSettings)
virtual ::sal_Int32 SAL_CALL getCount() override
virtual ::sal_Int32 SAL_CALL getNextSlideIndex() override
virtual void SAL_CALL pause() override
sal_Int32 mnUserPaintColor
virtual void SAL_CALL gotoFirstSlide() override
virtual sal_Bool SAL_CALL isPaused() override
SdDrawDocument * mpDoc
virtual void SAL_CALL activate() override
void endPresentation()
ends the presentation async
virtual void SAL_CALL gotoSlideIndex(::sal_Int32 Index) override
virtual css::uno::Reference< css::drawing::XDrawPage > SAL_CALL getCurrentSlide() override
bool swipe(const CommandGestureSwipeData &rSwipeData)
void ContextMenuSelectHdl(std::u16string_view rIdent)
void setActiveXToolbarsVisible(bool bVisible)
void slideEnded(const bool bReverse)
rtl::Reference< sd::SlideShowView > mxView
virtual ::sal_Int32 SAL_CALL getSlideCount() override
VclPtr< vcl::Window > mpParentWindow
sal_Int32 getCurrentSlideNumber() const
virtual void SAL_CALL gotoNextSlide() override
std::map< css::uno::Reference< css::drawing::XShape >, WrappedShapeEventImplPtr > maShapeEventMap
ViewShell * mpViewShell
void click(const css::uno::Reference< css::drawing::XShape > &xShape)
void createSlideList(bool bAll, std::u16string_view rPresSlide)
virtual ::sal_Int32 SAL_CALL getPenColor() override
bool isInputFreezed() const
virtual void SAL_CALL gotoLastSlide() override
SfxViewFrame * getViewFrame() const
DrawDocShell * mpDocSh
virtual void SAL_CALL gotoPreviousSlide() override
virtual sal_Bool SAL_CALL isRunning() override
virtual css::uno::Type SAL_CALL getElementType() override
virtual ::sal_Int32 SAL_CALL getCurrentSlideIndex() override
virtual void SAL_CALL resume() override
virtual void SAL_CALL setUsePen(sal_Bool _usepen) override
css::uno::Reference< css::presentation::XSlideShow > mxShow
Link< StarBASIC *, bool > maStarBASICGlobalErrorHdl
bool keyInput(const KeyEvent &rKEvt)
AnimationMode meAnimationMode
virtual double SAL_CALL getPenWidth() override
virtual sal_Bool SAL_CALL getMouseVisible() override
virtual void SAL_CALL setAlwaysOnTop(sal_Bool _alwaysontop) override
virtual void SAL_CALL deactivate() override
bool startPreview(const css::uno::Reference< css::drawing::XDrawPage > &xDrawPage, const css::uno::Reference< css::animations::XAnimationNode > &xAnimationNode, vcl::Window *pParent)
bool longpress(const CommandGestureLongPressData &rLongPressData)
PresentationSettings maPresSettings
SfxDispatcher * getDispatcher() const
ImplSVEvent * mnContextMenuEvent
virtual void SAL_CALL addSlideShowListener(const css::uno::Reference< css::presentation::XSlideShowListener > &Listener) override
virtual void disposing(std::unique_lock< std::mutex > &) override
virtual void SAL_CALL gotoSlide(const css::uno::Reference< css::drawing::XDrawPage > &Page) override
css::uno::Reference< css::frame::XModel > mxModel
virtual ~SlideshowImpl() override
virtual void SAL_CALL setMouseVisible(sal_Bool _mousevisible) override
::tools::ULong mnChildMask
void updateSlideShow()
Called by our maUpdateTimer's updateHdl handler this method is responsible to call the slideshow upda...
css::uno::Reference< css::media::XPlayer > mxPlayer
DECL_LINK(endPresentationHdl, void *, void)
virtual css::uno::Any SAL_CALL getByIndex(::sal_Int32 Index) override
void contextMenuShow(const css::awt::Point &point)
virtual sal_Bool SAL_CALL isFullScreen() override
void operator=(SlideshowImpl const &)=delete
Base class of the stacked shell hierarchy.
Definition: ViewShell.hxx:92
def point()
comphelper::WeakComponentImplHelper< css::presentation::XSlideShowController, css::container::XIndexAccess > SlideshowImplBase
std::shared_ptr< WrappedShapeEventImpl > WrappedShapeEventImplPtr
AnimationMode
Definition: slideshow.hxx:71
unsigned long ULong
long Long
void SetArguments(const css::uno::Sequence< css::beans::PropertyValue > &rArguments)
css::uno::Reference< css::animations::XAnimationNode > mxAnimationNode
void SetPropertyValue(std::u16string_view rProperty, const css::uno::Any &rValue)
PresentationSettingsEx(const PresentationSettingsEx &)
css::uno::Reference< css::drawing::XDrawPage > mxStartPage
VclPtr< vcl::Window > mpParentWindow
css::presentation::ClickAction meClickAction
Reference< XController > xController
unsigned char sal_Bool