1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
10 #include <rtl/strbuf.hxx>
11 #include <sal/log.hxx>
12 #include <vcl/svapp.hxx>
14 #include "Communicator.hxx"
15 #include "Listener.hxx"
16 #include "ImagePreparer.hxx"
17 #include "Transmitter.hxx"
19 #include <com/sun/star/presentation/XSlideShowController.hpp>
22 using namespace ::com::sun::star::presentation
;
24 Listener::Listener( const ::rtl::Reference
<Communicator
>& rCommunicator
,
25 sd::Transmitter
*aTransmitter
):
26 ::cppu::WeakComponentImplHelper
< XSlideShowListener
>( m_aMutex
),
27 mCommunicator( rCommunicator
),
28 pTransmitter( nullptr )
30 pTransmitter
= aTransmitter
;
37 void Listener::init( const css::uno::Reference
< css::presentation::XSlideShowController
>& aController
)
39 if ( aController
.is() )
41 mController
.set( aController
);
42 aController
->addSlideShowListener( this );
44 sal_Int32 aSlides
= aController
->getSlideCount();
45 sal_Int32 aCurrentSlide
= aController
->getCurrentSlideIndex();
46 OStringBuffer aBuffer
;
47 aBuffer
.append( "slideshow_started\n" )
48 .append( OString::number( aSlides
) ).append("\n")
49 .append( OString::number( aCurrentSlide
) ).append( "\n\n" );
51 pTransmitter
->addMessage( aBuffer
.makeStringAndClear(),
52 Transmitter::PRIORITY_HIGH
);
55 SolarMutexGuard aGuard
;
56 /* ImagePreparer* pPreparer = */ new ImagePreparer( aController
, pTransmitter
);
61 SAL_INFO( "sdremote", "Listener::init but no controller - so no preview push queued" );
65 //----- XAnimationListener ----------------------------------------------------
67 void SAL_CALL
Listener::beginEvent(const css::uno::Reference
<
68 css::animations::XAnimationNode
>& )
71 void SAL_CALL
Listener::endEvent( const css::uno::Reference
<
72 css::animations::XAnimationNode
>& )
75 void SAL_CALL
Listener::repeat( const css::uno::Reference
<
76 css::animations::XAnimationNode
>&, ::sal_Int32
)
79 //----- XSlideShowListener ----------------------------------------------------
81 void SAL_CALL
Listener::paused()
85 void SAL_CALL
Listener::resumed()
89 void SAL_CALL
Listener::slideEnded (sal_Bool
)
93 void SAL_CALL
Listener::hyperLinkClicked (const OUString
&)
97 void SAL_CALL
Listener::slideTransitionStarted()
99 sal_Int32 aSlide
= mController
->getCurrentSlideIndex();
101 OStringBuffer
aBuilder( "slide_updated\n" );
102 aBuilder
.append( OString::number( aSlide
) );
103 aBuilder
.append( "\n\n" );
107 pTransmitter
->addMessage( aBuilder
.makeStringAndClear(),
108 Transmitter::PRIORITY_HIGH
);
112 void SAL_CALL
Listener::slideTransitionEnded()
116 void SAL_CALL
Listener::slideAnimationsEnded()
120 void SAL_CALL
Listener::disposing()
122 pTransmitter
= nullptr;
123 if ( mController
.is() )
125 mController
->removeSlideShowListener( this );
126 mController
= nullptr;
128 mCommunicator
->informListenerDestroyed();
131 void SAL_CALL
Listener::disposing (
132 const css::lang::EventObject
&)
136 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */