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 :
10 : #include <comphelper/processfactory.hxx>
11 : #include <com/sun/star/presentation/XPresentationSupplier.hpp>
12 : #include <com/sun/star/presentation/XPresentation2.hpp>
13 : #include <rtl/strbuf.hxx>
14 : #include <vcl/svapp.hxx>
15 :
16 : #include "Listener.hxx"
17 : #include "ImagePreparer.hxx"
18 :
19 :
20 : using namespace sd;
21 : using namespace ::com::sun::star::presentation;
22 : using namespace ::com::sun::star::frame;
23 :
24 :
25 0 : Listener::Listener( const ::rtl::Reference<Communicator>& rCommunicator,
26 : sd::Transmitter *aTransmitter ):
27 : ::cppu::WeakComponentImplHelper1< XSlideShowListener >( m_aMutex ),
28 : mCommunicator( rCommunicator ),
29 0 : pTransmitter( NULL )
30 : {
31 0 : pTransmitter = aTransmitter;
32 0 : }
33 :
34 0 : Listener::~Listener()
35 : {
36 0 : }
37 :
38 0 : void Listener::init( const css::uno::Reference< css::presentation::XSlideShowController >& aController)
39 : {
40 0 : if ( aController.is() )
41 : {
42 0 : mController = css::uno::Reference< css::presentation::XSlideShowController >( aController );
43 0 : aController->addSlideShowListener( this );
44 :
45 0 : sal_Int32 aSlides = aController->getSlideCount();
46 0 : sal_Int32 aCurrentSlide = aController->getCurrentSlideIndex();
47 0 : OStringBuffer aBuffer;
48 0 : aBuffer.append( "slideshow_started\n" )
49 0 : .append( OString::number( aSlides ) ).append("\n")
50 0 : .append( OString::number( aCurrentSlide ) ).append( "\n\n" );
51 :
52 : pTransmitter->addMessage( aBuffer.makeStringAndClear(),
53 0 : Transmitter::PRIORITY_HIGH );
54 :
55 : {
56 0 : SolarMutexGuard aGuard;
57 0 : /* ImagePreparer* pPreparer = */ new ImagePreparer( aController, pTransmitter );
58 0 : }
59 : }
60 : else
61 : {
62 : SAL_INFO( "sdremote", "Listener::init but no controller - so no preview push queued" );
63 : }
64 0 : }
65 :
66 : //----- XAnimationListener ----------------------------------------------------
67 :
68 0 : void SAL_CALL Listener::beginEvent(const css::uno::Reference<
69 : css::animations::XAnimationNode >& rNode ) throw (css::uno::RuntimeException, std::exception)
70 : {
71 : (void) rNode;
72 0 : }
73 :
74 0 : void SAL_CALL Listener::endEvent( const css::uno::Reference<
75 : css::animations::XAnimationNode >& rNode ) throw (css::uno::RuntimeException, std::exception)
76 : {
77 : (void) rNode;
78 0 : }
79 :
80 0 : void SAL_CALL Listener::repeat( const css::uno::Reference<
81 : css::animations::XAnimationNode >& rNode, ::sal_Int32 aRepeat )
82 : throw (css::uno::RuntimeException, std::exception)
83 : {
84 : (void) rNode;
85 : (void) aRepeat;
86 0 : }
87 :
88 : //----- XSlideShowListener ----------------------------------------------------
89 :
90 0 : void SAL_CALL Listener::paused (void)
91 : throw (com::sun::star::uno::RuntimeException, std::exception)
92 : {
93 0 : }
94 :
95 0 : void SAL_CALL Listener::resumed (void)
96 : throw (css::uno::RuntimeException, std::exception)
97 : {
98 0 : }
99 :
100 0 : void SAL_CALL Listener::slideEnded (sal_Bool bReverse)
101 : throw (css::uno::RuntimeException, std::exception)
102 : {
103 : (void) bReverse;
104 0 : }
105 :
106 0 : void SAL_CALL Listener::hyperLinkClicked (const OUString &)
107 : throw (css::uno::RuntimeException, std::exception)
108 : {
109 0 : }
110 :
111 0 : void SAL_CALL Listener::slideTransitionStarted (void)
112 : throw (css::uno::RuntimeException, std::exception)
113 : {
114 0 : sal_Int32 aSlide = mController->getCurrentSlideIndex();
115 :
116 0 : OStringBuffer aBuilder( "slide_updated\n" );
117 0 : aBuilder.append( OString::number( aSlide ) );
118 0 : aBuilder.append( "\n\n" );
119 :
120 0 : if ( pTransmitter )
121 : {
122 : pTransmitter->addMessage( aBuilder.makeStringAndClear(),
123 0 : Transmitter::PRIORITY_HIGH );
124 0 : }
125 0 : }
126 :
127 0 : void SAL_CALL Listener::slideTransitionEnded (void)
128 : throw (css::uno::RuntimeException, std::exception)
129 : {
130 0 : }
131 :
132 0 : void SAL_CALL Listener::slideAnimationsEnded (void)
133 : throw (css::uno::RuntimeException, std::exception)
134 : {
135 0 : }
136 :
137 0 : void SAL_CALL Listener::disposing (void)
138 : {
139 0 : pTransmitter = NULL;
140 0 : if ( mController.is() )
141 : {
142 0 : mController->removeSlideShowListener( this );
143 0 : mController = NULL;
144 : }
145 0 : mCommunicator->informListenerDestroyed();
146 0 : }
147 :
148 0 : void SAL_CALL Listener::disposing (
149 : const css::lang::EventObject& rEvent)
150 : throw (::com::sun::star::uno::RuntimeException, std::exception)
151 : {
152 : (void) rEvent;
153 0 : dispose();
154 0 : }
155 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|