44 virtual bool IsEnabled()
const {
return true; }
48 class GotoPreviousSlideCommand :
public Command
51 explicit GotoPreviousSlideCommand (
53 virtual void Execute()
override;
54 virtual bool IsEnabled()
const override;
59 class GotoNextSlideCommand :
public Command
62 explicit GotoNextSlideCommand (
64 virtual void Execute()
override;
68 virtual bool IsEnabled()
const override {
return true; }
73 class GotoNextEffectCommand :
public Command
76 explicit GotoNextEffectCommand (
78 virtual void Execute()
override;
79 virtual bool IsEnabled()
const override;
84 class SwitchMonitorCommand :
public Command
87 explicit SwitchMonitorCommand (
89 virtual void Execute()
override;
94 class PauseResumeCommand :
public Command
98 virtual void Execute()
override;
105 class RestartTimerCommand :
public Command
109 virtual void Execute()
override;
114 class SetNotesViewCommand :
public Command
117 SetNotesViewCommand (
120 virtual void Execute()
override;
127 class SetSlideSorterCommand :
public Command
130 SetSlideSorterCommand (
133 virtual void Execute()
override;
140 class SetHelpViewCommand :
public Command
146 virtual void Execute()
override;
153 class NotesFontSizeCommand :
public Command
156 NotesFontSizeCommand(
158 const sal_Int32 nSizeChange);
159 virtual void Execute()
override;
168 class ExitPresenterCommand :
public Command
172 virtual void Execute()
override;
180 typedef ::cppu::WeakComponentImplHelper <
181 css::frame::XDispatch,
182 css::document::XEventListener
183 > PresenterDispatchInterfaceBase;
188 public PresenterDispatchInterfaceBase
194 static Reference<frame::XDispatch>
Create (
195 const OUString& rsURLPath,
196 const ::rtl::Reference<PresenterController>& rpPresenterController);
200 std::u16string_view rsURLPath,
201 const ::rtl::Reference<PresenterController>& rpPresenterController);
205 const css::util::URL&
aURL,
206 const css::uno::Sequence<css::beans::PropertyValue>& rArguments)
override;
209 const css::uno::Reference<css::frame::XStatusListener>& rxListener,
210 const css::util::URL& rURL)
override;
213 const css::uno::Reference<css::frame::XStatusListener>& rxListener,
214 const css::util::URL& rURL)
override;
218 virtual void SAL_CALL
notifyEvent (
const css::document::EventObject& rEvent)
override;
222 virtual void SAL_CALL
disposing (
const css::lang::EventObject& rEvent)
override;
233 const OUString& rsURLPath,
234 const ::rtl::Reference<PresenterController>& rpPresenterController);
264 Reference<frame::XFrame>
xFrame;
278 return "org.libreoffice.comp.PresenterScreenProtocolHandler";
286css::uno::Sequence<OUString>
289 return {
"com.sun.star.frame.ProtocolHandler" };
292extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
294 css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any>
const&)
302 const css::util::URL& rURL,
322 const Sequence<frame::DispatchDescriptor>&)
325 return Sequence<Reference<frame::XDispatch> >();
331 if (rBHelper.bDisposed || rBHelper.bInDispose)
333 throw lang::DisposedException (
334 "PresenterProtocolHandler object has already been disposed",
335 const_cast<uno::XWeak*
>(
static_cast<const uno::XWeak*
>(
this)));
342 const OUString& rsURLPath,
343 const ::rtl::Reference<PresenterController>& rpPresenterController)
346 if (pDispatch->mpCommand !=
nullptr)
353 const OUString& rsURLPath,
354 const ::rtl::Reference<PresenterController>& rpPresenterController)
355 : PresenterDispatchInterfaceBase(
m_aMutex),
356 msURLPath(rsURLPath),
357 mpCommand(CreateCommand(rsURLPath, rpPresenterController)),
359 mbIsListeningToWindowManager(false)
369 std::u16string_view rsURLPath,
370 const ::rtl::Reference<PresenterController>& rpPresenterController)
372 if (rsURLPath.size() <= 5)
375 if (rsURLPath ==
u"CloseNotes")
376 return new SetNotesViewCommand(
false, rpPresenterController);
377 if (rsURLPath ==
u"CloseSlideSorter")
378 return new SetSlideSorterCommand(
false, rpPresenterController);
379 if (rsURLPath ==
u"CloseHelp")
380 return new SetHelpViewCommand(
false, rpPresenterController);
381 if (rsURLPath ==
u"GrowNotesFont")
382 return new NotesFontSizeCommand(rpPresenterController, +1);
383 if (rsURLPath ==
u"NextEffect")
384 return new GotoNextEffectCommand(rpPresenterController);
385 if (rsURLPath ==
u"NextSlide")
386 return new GotoNextSlideCommand(rpPresenterController);
387 if (rsURLPath ==
u"PrevSlide")
388 return new GotoPreviousSlideCommand(rpPresenterController);
389 if (rsURLPath ==
u"SwitchMonitor")
390 return new SwitchMonitorCommand(rpPresenterController);
391 if (rsURLPath ==
u"PauseResumeTimer")
392 return new PauseResumeCommand(rpPresenterController);
393 if (rsURLPath ==
u"RestartTimer")
394 return new RestartTimerCommand(rpPresenterController);
395 if (rsURLPath ==
u"ShowNotes")
396 return new SetNotesViewCommand(
true, rpPresenterController);
397 if (rsURLPath ==
u"ShowSlideSorter")
398 return new SetSlideSorterCommand(
true, rpPresenterController);
399 if (rsURLPath ==
u"ShowHelp")
400 return new SetHelpViewCommand(
true, rpPresenterController);
401 if (rsURLPath ==
u"ShrinkNotesFont")
402 return new NotesFontSizeCommand(rpPresenterController, -1);
403 if (rsURLPath ==
u"ExitPresenter")
404 return new ExitPresenterCommand(rpPresenterController);
415 if (mbIsListeningToWindowManager)
419 mbIsListeningToWindowManager =
false;
429 const css::util::URL& rURL,
430 const css::uno::Sequence<css::beans::PropertyValue>& )
432 if (rBHelper.bDisposed || rBHelper.bInDispose)
434 throw lang::DisposedException (
435 "PresenterProtocolHandler::Dispatch object has already been disposed",
436 static_cast<uno::XWeak*
>(
this));
439 if (rURL.Protocol !=
"vnd.org.libreoffice.presenterscreen:"
440 || rURL.Path != msURLPath)
446 if (mpCommand !=
nullptr)
447 mpCommand->Execute();
451 const css::uno::Reference<css::frame::XStatusListener>& rxListener,
452 const css::util::URL& rURL)
454 if (rURL.Path != msURLPath)
457 maStatusListenerContainer.push_back(rxListener);
459 frame::FeatureStateEvent
aEvent;
461 aEvent.IsEnabled = mpCommand->IsEnabled();
463 aEvent.State = mpCommand->GetState();
464 rxListener->statusChanged(
aEvent);
468 const css::uno::Reference<css::frame::XStatusListener>& rxListener,
469 const css::util::URL& rURL)
471 if (rURL.Path != msURLPath)
474 StatusListenerContainer::iterator iListener (
476 maStatusListenerContainer.begin(),
477 maStatusListenerContainer.end(),
479 if (iListener != maStatusListenerContainer.end())
480 maStatusListenerContainer.erase(iListener);
486 const css::document::EventObject&)
488 mpCommand->GetState();
495 mbIsListeningToWindowManager =
false;
500GotoPreviousSlideCommand::GotoPreviousSlideCommand (
506void GotoPreviousSlideCommand::Execute()
517bool GotoPreviousSlideCommand::IsEnabled()
const
530GotoNextEffectCommand::GotoNextEffectCommand (
536void GotoNextEffectCommand::Execute()
547bool GotoNextEffectCommand::IsEnabled()
const
561GotoNextSlideCommand::GotoNextSlideCommand (
567void GotoNextSlideCommand::Execute()
580SwitchMonitorCommand::SwitchMonitorCommand (
586void SwitchMonitorCommand::Execute()
598void PauseResumeCommand::Execute()
605 if ( ! pWindowManager.is())
609 if (!pPresentationTime)
612 if(pPresentationTime->isPaused())
614 pPresentationTime->setPauseStatus(
false);
615 pWindowManager->SetPauseState(
false);
619 pPresentationTime->setPauseStatus(
true);
620 pWindowManager->SetPauseState(
true);
624Any PauseResumeCommand::GetState()
const
631 if ( ! pWindowManager.is())
636 return Any(pPresentationTime->isPaused());
647void RestartTimerCommand::Execute()
654 if ( ! pWindowManager.is())
660 pPresentationTime->setPauseStatus(
false);
661 pWindowManager->SetPauseState(
false);
662 pPresentationTime->restart();
668SetNotesViewCommand::SetNotesViewCommand (
676void SetNotesViewCommand::Execute()
683 if ( ! pWindowManager.is())
692Any SetNotesViewCommand::GetState()
const
699 if ( ! pWindowManager.is())
707SetSlideSorterCommand::SetSlideSorterCommand (
715void SetSlideSorterCommand::Execute()
722 if ( ! pWindowManager.is())
725 pWindowManager->SetSlideSorterState(
mbOn);
728Any SetSlideSorterCommand::GetState()
const
735 if ( ! pWindowManager.is())
743SetHelpViewCommand::SetHelpViewCommand (
751void SetHelpViewCommand::Execute()
758 if ( ! pWindowManager.is())
761 pWindowManager->SetHelpViewState(
mbOn);
764Any SetHelpViewCommand::GetState()
const
771 if ( ! pWindowManager.is())
779NotesFontSizeCommand::NotesFontSizeCommand(
781 const sal_Int32 nSizeChange)
798 return dynamic_cast<PresenterNotesView*
>(pDescriptor->mxView.get());
801void NotesFontSizeCommand::Execute()
808Any NotesFontSizeCommand::GetState()
const
820void ExitPresenterCommand::Execute()
const sal_Int32 mnSizeChange
rtl::Reference< PresenterController > mpPresenterController
mutable::osl::Mutex m_aMutex
static ::rtl::Reference< PresenterController > Instance(const css::uno::Reference< css::frame::XFrame > &rxFrame)
std::shared_ptr< PaneDescriptor > SharedPaneDescriptor
static Reference< frame::XDispatch > Create(const OUString &rsURLPath, const ::rtl::Reference< PresenterController > &rpPresenterController)
Create a new Dispatch object.
std::unique_ptr< Command > mpCommand
virtual void SAL_CALL dispatch(const css::util::URL &aURL, const css::uno::Sequence< css::beans::PropertyValue > &rArguments) override
::std::vector< Reference< frame::XStatusListener > > StatusListenerContainer
void SAL_CALL disposing() override
virtual ~Dispatch() override
::rtl::Reference< PresenterController > mpPresenterController
virtual void SAL_CALL removeStatusListener(const css::uno::Reference< css::frame::XStatusListener > &rxListener, const css::util::URL &rURL) override
Dispatch(const OUString &rsURLPath, const ::rtl::Reference< PresenterController > &rpPresenterController)
bool mbIsListeningToWindowManager
static Command * CreateCommand(std::u16string_view rsURLPath, const ::rtl::Reference< PresenterController > &rpPresenterController)
virtual void SAL_CALL addStatusListener(const css::uno::Reference< css::frame::XStatusListener > &rxListener, const css::util::URL &rURL) override
StatusListenerContainer maStatusListenerContainer
virtual void SAL_CALL notifyEvent(const css::document::EventObject &rEvent) override
virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch(const css::util::URL &aURL, const OUString &aTargetFrameName, sal_Int32 nSearchFlags) override
sal_Bool SAL_CALL supportsService(OUString const &ServiceName) override
OUString SAL_CALL getImplementationName() override
::rtl::Reference< PresenterController > mpPresenterController
css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
void ThrowIfDisposed() const
virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any > &aArguments) override
virtual ~PresenterProtocolHandler() override
PresenterProtocolHandler()
virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL queryDispatches(const css::uno::Sequence< css::frame::DispatchDescriptor > &rDescriptors) override
void SAL_CALL disposing() override
static constexpr OUStringLiteral msNotesViewURL
Reference< XDispatch > xDispatch
Sequence< PropertyValue > aArguments
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * sd_PresenterProtocolHandler_get_implementation(css::uno::XComponentContext *, css::uno::Sequence< css::uno::Any > const &)
::cppu::WeakComponentImplHelper< css::lang::XInitialization, css::lang::XServiceInfo, css::util::XCacheInfo, css::frame::XDispatchProvider > PresenterProtocolHandlerInterfaceBase
Reference< XFrame > xFrame