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