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 <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>
16 #include "Listener.hxx"
17 #include "ImagePreparer.hxx"
20 using namespace ::com::sun::star::presentation
;
21 using namespace ::com::sun::star::frame
;
23 Listener::Listener( const ::rtl::Reference
<Communicator
>& rCommunicator
,
24 sd::Transmitter
*aTransmitter
):
25 ::cppu::WeakComponentImplHelper1
< XSlideShowListener
>( m_aMutex
),
26 mCommunicator( rCommunicator
),
29 pTransmitter
= aTransmitter
;
36 void Listener::init( const css::uno::Reference
< css::presentation::XSlideShowController
>& aController
)
38 if ( aController
.is() )
40 mController
= css::uno::Reference
< css::presentation::XSlideShowController
>( aController
);
41 aController
->addSlideShowListener( this );
43 sal_Int32 aSlides
= aController
->getSlideCount();
44 sal_Int32 aCurrentSlide
= aController
->getCurrentSlideIndex();
45 OStringBuffer aBuffer
;
46 aBuffer
.append( "slideshow_started\n" )
47 .append( OString::number( aSlides
) ).append("\n")
48 .append( OString::number( aCurrentSlide
) ).append( "\n\n" );
50 pTransmitter
->addMessage( aBuffer
.makeStringAndClear(),
51 Transmitter::PRIORITY_HIGH
);
54 SolarMutexGuard aGuard
;
55 /* ImagePreparer* pPreparer = */ new ImagePreparer( aController
, pTransmitter
);
60 SAL_INFO( "sdremote", "Listener::init but no controller - so no preview push queued" );
64 //----- XAnimationListener ----------------------------------------------------
66 void SAL_CALL
Listener::beginEvent(const css::uno::Reference
<
67 css::animations::XAnimationNode
>& rNode
) throw (css::uno::RuntimeException
, std::exception
)
72 void SAL_CALL
Listener::endEvent( const css::uno::Reference
<
73 css::animations::XAnimationNode
>& rNode
) throw (css::uno::RuntimeException
, std::exception
)
78 void SAL_CALL
Listener::repeat( const css::uno::Reference
<
79 css::animations::XAnimationNode
>& rNode
, ::sal_Int32 aRepeat
)
80 throw (css::uno::RuntimeException
, std::exception
)
86 //----- XSlideShowListener ----------------------------------------------------
88 void SAL_CALL
Listener::paused()
89 throw (com::sun::star::uno::RuntimeException
, std::exception
)
93 void SAL_CALL
Listener::resumed()
94 throw (css::uno::RuntimeException
, std::exception
)
98 void SAL_CALL
Listener::slideEnded (sal_Bool bReverse
)
99 throw (css::uno::RuntimeException
, std::exception
)
104 void SAL_CALL
Listener::hyperLinkClicked (const OUString
&)
105 throw (css::uno::RuntimeException
, std::exception
)
109 void SAL_CALL
Listener::slideTransitionStarted()
110 throw (css::uno::RuntimeException
, std::exception
)
112 sal_Int32 aSlide
= mController
->getCurrentSlideIndex();
114 OStringBuffer
aBuilder( "slide_updated\n" );
115 aBuilder
.append( OString::number( aSlide
) );
116 aBuilder
.append( "\n\n" );
120 pTransmitter
->addMessage( aBuilder
.makeStringAndClear(),
121 Transmitter::PRIORITY_HIGH
);
125 void SAL_CALL
Listener::slideTransitionEnded()
126 throw (css::uno::RuntimeException
, std::exception
)
130 void SAL_CALL
Listener::slideAnimationsEnded()
131 throw (css::uno::RuntimeException
, std::exception
)
135 void SAL_CALL
Listener::disposing()
138 if ( mController
.is() )
140 mController
->removeSlideShowListener( this );
143 mCommunicator
->informListenerDestroyed();
146 void SAL_CALL
Listener::disposing (
147 const css::lang::EventObject
& rEvent
)
148 throw (::com::sun::star::uno::RuntimeException
, std::exception
)
153 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */