Branch data 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 : :
14 : : #include <rtl/strbuf.hxx>
15 : :
16 : : #include "Listener.hxx"
17 : :
18 : : using namespace sd;
19 : : using namespace ::com::sun::star::presentation;
20 : : using namespace ::com::sun::star::frame;
21 : : using rtl::OString;
22 : : using rtl::OStringBuffer;
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 : : pTransmitter( NULL ),
30 [ # # ]: 0 : mPreparer()
31 : : {
32 : 0 : pTransmitter = aTransmitter;
33 : 0 : }
34 : :
35 [ # # ][ # # ]: 0 : Listener::~Listener()
[ # # ]
36 : : {
37 [ # # ]: 0 : }
38 : :
39 : 0 : void Listener::init( const css::uno::Reference< css::presentation::XSlideShowController >& aController)
40 : : {
41 [ # # ]: 0 : if ( aController.is() )
42 : : {
43 [ # # ]: 0 : mController = css::uno::Reference< css::presentation::XSlideShowController >( aController );
44 [ # # ][ # # ]: 0 : aController->addSlideShowListener( this );
[ # # ]
45 : :
46 [ # # ][ # # ]: 0 : sal_Int32 aSlides = aController->getSlideCount();
47 [ # # ][ # # ]: 0 : sal_Int32 aCurrentSlide = aController->getCurrentSlideIndex();
48 : 0 : OStringBuffer aBuffer;
49 [ # # ]: 0 : aBuffer.append( "slideshow_started\n" )
50 [ # # ][ # # ]: 0 : .append( OString::valueOf( aSlides ) ).append("\n")
51 [ # # ][ # # ]: 0 : .append( OString::valueOf( aCurrentSlide ) ).append( "\n\n" );
52 : :
53 : : pTransmitter->addMessage( aBuffer.makeStringAndClear(),
54 [ # # ]: 0 : Transmitter::PRIORITY_HIGH );
55 : :
56 [ # # ][ # # ]: 0 : mPreparer.set( new ImagePreparer( aController, pTransmitter, mPreparer ) );
[ # # ]
57 [ # # ]: 0 : mPreparer->launch();
58 : : }
59 : : else
60 : : {
61 : : }
62 : 0 : }
63 : :
64 : : //----- XAnimationListener ----------------------------------------------------
65 : 0 : void SAL_CALL Listener::beginEvent(const css::uno::Reference<
66 : : css::animations::XAnimationNode >& rNode ) throw (css::uno::RuntimeException)
67 : : {
68 : : (void) rNode;
69 : 0 : }
70 : :
71 : :
72 : 0 : void SAL_CALL Listener::endEvent( const css::uno::Reference<
73 : : css::animations::XAnimationNode >& rNode ) throw (css::uno::RuntimeException)
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)
81 : : {
82 : : (void) rNode;
83 : : (void) aRepeat;
84 : 0 : }
85 : :
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 rtl::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 : if ( mPreparer.is() )
139 : : {
140 [ # # ]: 0 : delete mPreparer.get();
141 : 0 : mPreparer = NULL;
142 : : }
143 : :
144 : 0 : pTransmitter = NULL;
145 [ # # ]: 0 : if ( mController.is() )
146 : : {
147 [ # # ]: 0 : mController->removeSlideShowListener( this );
148 : 0 : mController = NULL;
149 : : }
150 : 0 : mCommunicator->informListenerDestroyed();
151 : 0 : }
152 : :
153 : 0 : void SAL_CALL Listener::disposing (
154 : : const css::lang::EventObject& rEvent)
155 : : throw (::com::sun::star::uno::RuntimeException)
156 : : {
157 : : (void) rEvent;
158 : 0 : dispose();
159 : 0 : }
160 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|