LibreOffice Module sd (master) 1
PresenterCurrentSlideObserver.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 <utility>
21
23
24using namespace ::com::sun::star;
25using namespace ::com::sun::star::uno;
26
27namespace sdext::presenter {
28
29//===== PresenterCurrentSlideObserver =========================================
30
32 ::rtl::Reference<PresenterController> xPresenterController,
33 const Reference<presentation::XSlideShowController>& rxSlideShowController)
35 mpPresenterController(std::move(xPresenterController)),
36 mxSlideShowController(rxSlideShowController)
37{
38 if( mpPresenterController.is() )
39 {
40 mpPresenterController->addEventListener(this);
41 }
42
43 if( mxSlideShowController.is() )
44 {
45 // Listen for events from the slide show controller.
46 mxSlideShowController->addSlideShowListener(static_cast<XSlideShowListener*>(this));
47 }
48}
49
51{
52}
53
55{
56 // Disconnect form the slide show controller.
58 {
59 mxSlideShowController->removeSlideShowListener(static_cast<XSlideShowListener*>(this));
60 mxSlideShowController = nullptr;
61 }
62
63 if (mpPresenterController.is())
64 mpPresenterController->removeEventListener(this);
65}
66
67//----- XSlideShowListener ----------------------------------------------------
68
70 const Reference<animations::XAnimationNode>&)
71{}
72
74 const Reference<animations::XAnimationNode>&)
75{}
76
78 const css::uno::Reference<css::animations::XAnimationNode>&,
79 sal_Int32)
80{}
81
83{
84}
85
87{
88}
89
91{
92 // Determine whether the new current slide (the one after the one that
93 // just ended) is the slide past the last slide in the presentation,
94 // i.e. the one that says something like "click to end presentation...".
95 if (mxSlideShowController.is() && !bReverse)
96 if (mxSlideShowController->getNextSlideIndex() < 0)
97 if( mpPresenterController.is() )
98 mpPresenterController->UpdateCurrentSlide(+1);
99}
100
102{
103}
104
106{
107 if( mpPresenterController.is() )
108 mpPresenterController->UpdateCurrentSlide(0);
109}
110
112{
113}
114
116{
117}
118
119//----- XEventListener --------------------------------------------------------
120
122 const lang::EventObject& rEvent)
123{
124 if (rEvent.Source == Reference<XInterface>(static_cast<XWeak*>(mpPresenterController.get())))
125 dispose();
126 else if (rEvent.Source == mxSlideShowController)
127 mxSlideShowController = nullptr;
128}
129
130} // end of namespace ::sdext::presenter
131
132/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
rtl::Reference< PresenterController > mpPresenterController
virtual void SAL_CALL repeat(const css::uno::Reference< css::animations::XAnimationNode > &Node, ::sal_Int32 Repeat) override
virtual void SAL_CALL hyperLinkClicked(const OUString &hyperLink) override
virtual void SAL_CALL slideEnded(sal_Bool bReverse) override
PresenterCurrentSlideObserver(::rtl::Reference< PresenterController > xPresenterController, const css::uno::Reference< css::presentation::XSlideShowController > &rxSlideShowController)
virtual void SAL_CALL beginEvent(const css::uno::Reference< css::animations::XAnimationNode > &Node) override
virtual void SAL_CALL endEvent(const css::uno::Reference< css::animations::XAnimationNode > &Node) override
::rtl::Reference< PresenterController > mpPresenterController
css::uno::Reference< css::presentation::XSlideShowController > mxSlideShowController
std::mutex m_aMutex
::cppu::WeakComponentImplHelper< css::presentation::XSlideShowListener > PresenterCurrentSlideObserverInterfaceBase
void dispose()
unsigned char sal_Bool