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