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 <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( ::rtl::Reference
<Communicator
> xCommunicator
,
25 sd::Transmitter
*aTransmitter
):
26 mCommunicator(std::move( xCommunicator
)),
27 pTransmitter( nullptr )
29 pTransmitter
= aTransmitter
;
36 void Listener::init( const css::uno::Reference
< css::presentation::XSlideShowController
>& aController
)
38 if ( aController
.is() )
40 mController
.set( aController
);
41 aController
->addSlideShowListener( this );
43 sal_Int32 aSlides
= aController
->getSlideCount();
44 sal_Int32 aCurrentSlide
= aController
->getCurrentSlideIndex();
45 OString aBuffer
= "slideshow_started\n" +
46 OString::number( aSlides
) + "\n" +
47 OString::number( aCurrentSlide
) + "\n\n";
49 pTransmitter
->addMessage( aBuffer
,
50 Transmitter::PRIORITY_HIGH
);
53 SolarMutexGuard aGuard
;
54 /* ImagePreparer* pPreparer = */ new ImagePreparer( aController
, pTransmitter
);
59 SAL_INFO( "sdremote", "Listener::init but no controller - so no preview push queued" );
63 //----- XAnimationListener ----------------------------------------------------
65 void SAL_CALL
Listener::beginEvent(const css::uno::Reference
<
66 css::animations::XAnimationNode
>& )
69 void SAL_CALL
Listener::endEvent( const css::uno::Reference
<
70 css::animations::XAnimationNode
>& )
73 void SAL_CALL
Listener::repeat( const css::uno::Reference
<
74 css::animations::XAnimationNode
>&, ::sal_Int32
)
77 //----- XSlideShowListener ----------------------------------------------------
79 void SAL_CALL
Listener::paused()
83 void SAL_CALL
Listener::resumed()
87 void SAL_CALL
Listener::slideEnded (sal_Bool
)
91 void SAL_CALL
Listener::hyperLinkClicked (const OUString
&)
95 void SAL_CALL
Listener::slideTransitionStarted()
97 sal_Int32 aSlide
= mController
->getCurrentSlideIndex();
99 OString aBuilder
= "slide_updated\n" +
100 OString::number( aSlide
) +
105 pTransmitter
->addMessage( aBuilder
,
106 Transmitter::PRIORITY_HIGH
);
110 void SAL_CALL
Listener::slideTransitionEnded()
114 void SAL_CALL
Listener::slideAnimationsEnded()
118 void Listener::disposing(std::unique_lock
<std::mutex
>&)
120 pTransmitter
= nullptr;
121 if ( mController
.is() )
123 mController
->removeSlideShowListener( this );
124 mController
= nullptr;
126 mCommunicator
->informListenerDestroyed();
129 void SAL_CALL
Listener::disposing (
130 const css::lang::EventObject
&)
134 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */