10#include <com/sun/star/presentation/XSlideShowController.hpp>
11#include <com/sun/star/presentation/XPresentationSupplier.hpp>
12#include <com/sun/star/presentation/XPresentation2.hpp>
13#include <com/sun/star/frame/Desktop.hpp>
14#include <com/sun/star/uno/RuntimeException.hpp>
18#include <com/sun/star/beans/PropertyValue.hpp>
52 std::vector< OString > aCommands(
maExecQueue.front() );
54 if( !aCommands.empty() )
64 uno::Reference<presentation::XSlideShowController> xSlideShowController;
65 uno::Reference<presentation::XPresentation2> xPresentation;
66 uno::Reference<presentation::XSlideShow> xSlideShow;
68 uno::Reference< frame::XDesktop2 > xFramesSupplier = frame::Desktop::create( ::comphelper::getProcessComponentContext() );
69 uno::Reference< frame::XFrame >
xFrame ( xFramesSupplier->getActiveFrame(), uno::UNO_SET_THROW );
70 uno::Reference<presentation::XPresentationSupplier> xPS (
xFrame->getController()->getModel(), uno::UNO_QUERY_THROW);
71 xPresentation.set( xPS->getPresentation(), uno::UNO_QUERY_THROW);
73 xSlideShowController.set( xPresentation->getController(), uno::UNO_SET_THROW );
74 xSlideShow.set( xSlideShowController->getSlideShow(), uno::UNO_SET_THROW );
76 catch (uno::RuntimeException &)
80 if (
aCommand[0] ==
"transition_next" )
82 if ( xSlideShowController.is() )
83 xSlideShowController->gotoNextEffect();
85 else if (
aCommand[0] ==
"transition_previous" )
87 if ( xSlideShowController.is() )
88 xSlideShowController->gotoPreviousEffect();
90 else if (
aCommand[0] ==
"goto_slide" )
93 sal_Int32 aSlide =
aCommand[1].toInt32();
94 if ( xSlideShowController.is() &&
95 xSlideShowController->getCurrentSlideIndex() != aSlide )
97 xSlideShowController->gotoSlideIndex( aSlide );
100 else if (
aCommand[0] ==
"presentation_start" )
102 if ( xPresentation.is() )
103 xPresentation->start();
105 else if (
aCommand[0] ==
"presentation_stop" )
107 if ( xPresentation.is() )
108 xPresentation->end();
110 else if (
aCommand[0] ==
"presentation_blank_screen" )
117 if ( xSlideShowController.is() )
119 xSlideShowController->blankScreen( 0 );
122 else if (
aCommand[0] ==
"pointer_started" )
129 const css::geometry::RealPoint2D
pos(
x,
y);
137 xSlideShow->setProperty(beans::PropertyValue(
"PointerPosition", -1,
Any(
pos),
138 beans::PropertyState_DIRECT_VALUE));
147 xSlideShow->setProperty(beans::PropertyValue(
"PointerVisible", -1,
Any(
true),
148 beans::PropertyState_DIRECT_VALUE));
156 SAL_INFO(
"sdremote",
"Pointer started, we display the pointer on screen" );
158 else if (
aCommand[0] ==
"pointer_dismissed" )
161 if (xSlideShow.is())
try
163 xSlideShow->setProperty(
164 beans::PropertyValue(
"PointerVisible" ,
167 beans::PropertyState_DIRECT_VALUE ) );
174 SAL_INFO(
"sdremote",
"Pointer dismissed, we hide the pointer on screen" );
176 else if (
aCommand[0] ==
"pointer_coordination" )
181 SAL_INFO(
"sdremote",
"Pointer at ("<<
x<<
","<<
y<<
")" );
182 const css::geometry::RealPoint2D
pos(
x,
y);
185 if (xSlideShow.is())
try
187 xSlideShow->setProperty(
188 beans::PropertyValue(
"PointerPosition" ,
191 beans::PropertyState_DIRECT_VALUE ) );
198 else if (
aCommand[0] ==
"presentation_resume" )
200 if ( xSlideShowController.is() )
202 xSlideShowController->resume();
void SetTimeout(sal_uInt64 nTimeoutMs)
virtual void Start(bool bStartTimer=true) override
virtual ~Receiver() override
void pushCommand(const std::vector< OString > &rCommand)
std::deque< std::vector< OString > > maExecQueue
static void executeCommand(const std::vector< OString > &aCommand)
Transmitter * pTransmitter
virtual void Invoke() override
#define TOOLS_WARN_EXCEPTION(area, stream)
#define SAL_INFO(area, stream)
Reference< XFrame > xFrame