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 "PresenterCurrentSlideObserver.hxx"
21 :
22 : using namespace ::com::sun::star;
23 : using namespace ::com::sun::star::uno;
24 : using ::rtl::OUString;
25 :
26 : namespace sdext { namespace presenter {
27 :
28 : //===== PresenterCurrentSlideObserver =========================================
29 :
30 0 : PresenterCurrentSlideObserver::PresenterCurrentSlideObserver (
31 : const ::rtl::Reference<PresenterController>& rxPresenterController,
32 : const Reference<presentation::XSlideShowController>& rxSlideShowController)
33 : : PresenterCurrentSlideObserverInterfaceBase(m_aMutex),
34 : mpPresenterController(rxPresenterController),
35 0 : mxSlideShowController(rxSlideShowController)
36 : {
37 0 : if( mpPresenterController.is() )
38 : {
39 0 : mpPresenterController->addEventListener(this);
40 : }
41 :
42 0 : if( mxSlideShowController.is() )
43 : {
44 : // Listen for events from the slide show controller.
45 0 : mxSlideShowController->addSlideShowListener(static_cast<XSlideShowListener*>(this));
46 : }
47 0 : }
48 :
49 0 : PresenterCurrentSlideObserver::~PresenterCurrentSlideObserver (void)
50 : {
51 0 : }
52 :
53 0 : void SAL_CALL PresenterCurrentSlideObserver::disposing (void)
54 : {
55 : // Disconnect form the slide show controller.
56 0 : if(mxSlideShowController.is())
57 : {
58 0 : mxSlideShowController->removeSlideShowListener(static_cast<XSlideShowListener*>(this));
59 0 : mxSlideShowController = NULL;
60 : }
61 0 : }
62 :
63 : //----- XSlideShowListener ----------------------------------------------------
64 :
65 0 : void SAL_CALL PresenterCurrentSlideObserver::beginEvent (
66 : const Reference<animations::XAnimationNode>& rNode)
67 : throw (css::uno::RuntimeException)
68 : {
69 : (void)rNode;
70 0 : }
71 :
72 0 : void SAL_CALL PresenterCurrentSlideObserver::endEvent (
73 : const Reference<animations::XAnimationNode>& rNode)
74 : throw(css::uno::RuntimeException)
75 : {
76 : (void)rNode;
77 0 : }
78 :
79 0 : void SAL_CALL PresenterCurrentSlideObserver::repeat (
80 : const css::uno::Reference<css::animations::XAnimationNode>& rNode,
81 : sal_Int32)
82 : throw (com::sun::star::uno::RuntimeException)
83 : {
84 : (void)rNode;
85 0 : }
86 :
87 0 : void SAL_CALL PresenterCurrentSlideObserver::paused (void)
88 : throw (com::sun::star::uno::RuntimeException)
89 : {
90 0 : }
91 :
92 0 : void SAL_CALL PresenterCurrentSlideObserver::resumed (void)
93 : throw (css::uno::RuntimeException)
94 : {
95 0 : }
96 :
97 0 : void SAL_CALL PresenterCurrentSlideObserver::slideEnded (sal_Bool bReverse)
98 : throw (css::uno::RuntimeException)
99 : {
100 : // Determine whether the new current slide (the one after the one that
101 : // just ended) is the slide past the last slide in the presentation,
102 : // i.e. the one that says something like "click to end presentation...".
103 0 : if (mxSlideShowController.is() && !bReverse)
104 0 : if (mxSlideShowController->getNextSlideIndex() < 0)
105 0 : if( mpPresenterController.is() )
106 0 : mpPresenterController->UpdateCurrentSlide(+1);
107 0 : }
108 :
109 0 : void SAL_CALL PresenterCurrentSlideObserver::hyperLinkClicked (const rtl::OUString &)
110 : throw (css::uno::RuntimeException)
111 : {
112 0 : }
113 :
114 0 : void SAL_CALL PresenterCurrentSlideObserver::slideTransitionStarted (void)
115 : throw (css::uno::RuntimeException)
116 : {
117 0 : if( mpPresenterController.is() )
118 0 : mpPresenterController->UpdateCurrentSlide(0);
119 0 : }
120 :
121 0 : void SAL_CALL PresenterCurrentSlideObserver::slideTransitionEnded (void)
122 : throw (css::uno::RuntimeException)
123 : {
124 0 : }
125 :
126 0 : void SAL_CALL PresenterCurrentSlideObserver::slideAnimationsEnded (void)
127 : throw (css::uno::RuntimeException)
128 : {
129 0 : }
130 :
131 : //----- XEventListener --------------------------------------------------------
132 :
133 0 : void SAL_CALL PresenterCurrentSlideObserver::disposing (
134 : const lang::EventObject& rEvent)
135 : throw (RuntimeException)
136 : {
137 0 : if (rEvent.Source == Reference<XInterface>(static_cast<XWeak*>(mpPresenterController.get())))
138 0 : dispose();
139 0 : else if (rEvent.Source == mxSlideShowController)
140 0 : mxSlideShowController = NULL;
141 0 : }
142 :
143 : } } // end of namespace ::sdext::presenter
144 :
145 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|