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