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"
21 using namespace ::com::sun::star::presentation
;
22 using namespace ::com::sun::star::frame
;
25 Listener::Listener( const ::rtl::Reference
<Communicator
>& rCommunicator
,
26 sd::Transmitter
*aTransmitter
):
27 ::cppu::WeakComponentImplHelper1
< XSlideShowListener
>( m_aMutex
),
28 mCommunicator( rCommunicator
),
31 pTransmitter
= aTransmitter
;
38 void Listener::init( const css::uno::Reference
< css::presentation::XSlideShowController
>& aController
)
40 if ( aController
.is() )
42 mController
= css::uno::Reference
< css::presentation::XSlideShowController
>( aController
);
43 aController
->addSlideShowListener( this );
45 sal_Int32 aSlides
= aController
->getSlideCount();
46 sal_Int32 aCurrentSlide
= aController
->getCurrentSlideIndex();
47 OStringBuffer aBuffer
;
48 aBuffer
.append( "slideshow_started\n" )
49 .append( OString::valueOf( aSlides
) ).append("\n")
50 .append( OString::valueOf( aCurrentSlide
) ).append( "\n\n" );
52 pTransmitter
->addMessage( aBuffer
.makeStringAndClear(),
53 Transmitter::PRIORITY_HIGH
);
56 SolarMutexGuard aGuard
;
57 /* ImagePreparer* pPreparer = */ new ImagePreparer( aController
, pTransmitter
);
65 //----- XAnimationListener ----------------------------------------------------
67 void SAL_CALL
Listener::beginEvent(const css::uno::Reference
<
68 css::animations::XAnimationNode
>& rNode
) throw (css::uno::RuntimeException
)
73 void SAL_CALL
Listener::endEvent( const css::uno::Reference
<
74 css::animations::XAnimationNode
>& rNode
) throw (css::uno::RuntimeException
)
79 void SAL_CALL
Listener::repeat( const css::uno::Reference
<
80 css::animations::XAnimationNode
>& rNode
, ::sal_Int32 aRepeat
)
81 throw (css::uno::RuntimeException
)
87 //----- XSlideShowListener ----------------------------------------------------
89 void SAL_CALL
Listener::paused (void)
90 throw (com::sun::star::uno::RuntimeException
)
94 void SAL_CALL
Listener::resumed (void)
95 throw (css::uno::RuntimeException
)
99 void SAL_CALL
Listener::slideEnded (sal_Bool bReverse
)
100 throw (css::uno::RuntimeException
)
105 void SAL_CALL
Listener::hyperLinkClicked (const OUString
&)
106 throw (css::uno::RuntimeException
)
110 void SAL_CALL
Listener::slideTransitionStarted (void)
111 throw (css::uno::RuntimeException
)
113 sal_Int32 aSlide
= mController
->getCurrentSlideIndex();
115 OStringBuffer
aBuilder( "slide_updated\n" );
116 aBuilder
.append( OString::valueOf( aSlide
) );
117 aBuilder
.append( "\n\n" );
121 pTransmitter
->addMessage( aBuilder
.makeStringAndClear(),
122 Transmitter::PRIORITY_HIGH
);
126 void SAL_CALL
Listener::slideTransitionEnded (void)
127 throw (css::uno::RuntimeException
)
131 void SAL_CALL
Listener::slideAnimationsEnded (void)
132 throw (css::uno::RuntimeException
)
136 void SAL_CALL
Listener::disposing (void)
139 if ( mController
.is() )
141 mController
->removeSlideShowListener( this );
144 mCommunicator
->informListenerDestroyed();
147 void SAL_CALL
Listener::disposing (
148 const css::lang::EventObject
& rEvent
)
149 throw (::com::sun::star::uno::RuntimeException
)
154 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */