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