43 virtual bool IsEnabled()
const {
return true; }
47 class GotoPreviousSlideCommand :
public Command
50 explicit GotoPreviousSlideCommand (
52 virtual void Execute()
override;
53 virtual bool IsEnabled()
const override;
58 class GotoNextSlideCommand :
public Command
61 explicit GotoNextSlideCommand (
63 virtual void Execute()
override;
67 virtual bool IsEnabled()
const override {
return true; }
72 class GotoNextEffectCommand :
public Command
75 explicit GotoNextEffectCommand (
77 virtual void Execute()
override;
78 virtual bool IsEnabled()
const override;
83 class SwitchMonitorCommand :
public Command
86 explicit SwitchMonitorCommand (
88 virtual void Execute()
override;
93 class PauseResumeCommand :
public Command
97 virtual void Execute()
override;
104 class RestartTimerCommand :
public Command
108 virtual void Execute()
override;
113 class SetNotesViewCommand :
public Command
116 SetNotesViewCommand (
119 virtual void Execute()
override;
126 class SetSlideSorterCommand :
public Command
129 SetSlideSorterCommand (
132 virtual void Execute()
override;
139 class SetHelpViewCommand :
public Command
145 virtual void Execute()
override;
152 class NotesFontSizeCommand :
public Command
155 NotesFontSizeCommand(
157 const sal_Int32 nSizeChange);
158 virtual void Execute()
override;
167 class ExitPresenterCommand :
public Command
171 virtual void Execute()
override;
179 typedef ::cppu::WeakComponentImplHelper <
180 css::frame::XDispatch,
181 css::document::XEventListener
182 > PresenterDispatchInterfaceBase;
187 public PresenterDispatchInterfaceBase
194 const OUString& rsURLPath,
195 const ::rtl::Reference<PresenterController>& rpPresenterController);
199 const OUString& rsURLPath,
200 const ::rtl::Reference<PresenterController>& rpPresenterController);
204 const css::util::URL&
aURL,
205 const css::uno::Sequence<css::beans::PropertyValue>& rArguments)
override;
208 const css::uno::Reference<css::frame::XStatusListener>& rxListener,
209 const css::util::URL& rURL)
override;
212 const css::uno::Reference<css::frame::XStatusListener>& rxListener,
213 const css::util::URL& rURL)
override;
217 virtual void SAL_CALL
notifyEvent (
const css::document::EventObject& rEvent)
override;
221 virtual void SAL_CALL
disposing (
const css::lang::EventObject& rEvent)
override;
232 const OUString& rsURLPath,
233 const ::rtl::Reference<PresenterController>& rpPresenterController);
258 if (aArguments.getLength() <= 0)
263 Reference<frame::XFrame>
xFrame;
264 if (aArguments[0] >>= xFrame)
277 return "org.libreoffice.comp.PresenterScreenProtocolHandler";
285 css::uno::Sequence<OUString>
288 return {
"com.sun.star.frame.ProtocolHandler" };
291 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
293 css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any>
const&)
301 const css::util::URL& rURL,
309 if (rURL.Protocol ==
"vnd.org.libreoffice.presenterscreen:")
318 const Sequence<frame::DispatchDescriptor>&)
321 return Sequence<Reference<frame::XDispatch> >();
327 if (rBHelper.bDisposed || rBHelper.bInDispose)
329 throw lang::DisposedException (
330 "PresenterProtocolHandler object has already been disposed",
331 const_cast<uno::XWeak*>(static_cast<const uno::XWeak*>(
this)));
338 const OUString& rsURLPath,
339 const ::rtl::Reference<PresenterController>& rpPresenterController)
342 if (pDispatch->mpCommand !=
nullptr)
349 const OUString& rsURLPath,
350 const ::rtl::Reference<PresenterController>& rpPresenterController)
351 : PresenterDispatchInterfaceBase(
m_aMutex),
352 msURLPath(rsURLPath),
353 mpCommand(CreateCommand(rsURLPath, rpPresenterController)),
355 mbIsListeningToWindowManager(
false)
365 const OUString& rsURLPath,
366 const ::rtl::Reference<PresenterController>& rpPresenterController)
368 if (rsURLPath.getLength() <= 5)
371 if (rsURLPath ==
"CloseNotes")
372 return new SetNotesViewCommand(
false, rpPresenterController);
373 if (rsURLPath ==
"CloseSlideSorter")
374 return new SetSlideSorterCommand(
false, rpPresenterController);
375 if (rsURLPath ==
"CloseHelp")
376 return new SetHelpViewCommand(
false, rpPresenterController);
377 if (rsURLPath ==
"GrowNotesFont")
378 return new NotesFontSizeCommand(rpPresenterController, +1);
379 if (rsURLPath ==
"NextEffect")
380 return new GotoNextEffectCommand(rpPresenterController);
381 if (rsURLPath ==
"NextSlide")
382 return new GotoNextSlideCommand(rpPresenterController);
383 if (rsURLPath ==
"PrevSlide")
384 return new GotoPreviousSlideCommand(rpPresenterController);
385 if (rsURLPath ==
"SwitchMonitor")
386 return new SwitchMonitorCommand(rpPresenterController);
387 if (rsURLPath ==
"PauseResumeTimer")
388 return new PauseResumeCommand(rpPresenterController);
389 if (rsURLPath ==
"RestartTimer")
390 return new RestartTimerCommand(rpPresenterController);
391 if (rsURLPath ==
"ShowNotes")
392 return new SetNotesViewCommand(
true, rpPresenterController);
393 if (rsURLPath ==
"ShowSlideSorter")
394 return new SetSlideSorterCommand(
true, rpPresenterController);
395 if (rsURLPath ==
"ShowHelp")
396 return new SetHelpViewCommand(
true, rpPresenterController);
397 if (rsURLPath ==
"ShrinkNotesFont")
398 return new NotesFontSizeCommand(rpPresenterController, -1);
399 if (rsURLPath ==
"ExitPresenter")
400 return new ExitPresenterCommand(rpPresenterController);
411 if (mbIsListeningToWindowManager)
415 mbIsListeningToWindowManager =
false;
425 const css::util::URL& rURL,
426 const css::uno::Sequence<css::beans::PropertyValue>& )
428 if (rBHelper.bDisposed || rBHelper.bInDispose)
430 throw lang::DisposedException (
431 "PresenterProtocolHandler::Dispatch object has already been disposed",
432 static_cast<uno::XWeak*>(
this));
435 if (rURL.Protocol !=
"vnd.org.libreoffice.presenterscreen:"
436 || rURL.Path != msURLPath)
442 if (mpCommand !=
nullptr)
443 mpCommand->Execute();
447 const css::uno::Reference<css::frame::XStatusListener>& rxListener,
448 const css::util::URL& rURL)
450 if (rURL.Path != msURLPath)
453 maStatusListenerContainer.push_back(rxListener);
455 frame::FeatureStateEvent
aEvent;
456 aEvent.FeatureURL = rURL;
457 aEvent.IsEnabled = mpCommand->IsEnabled();
458 aEvent.Requery =
false;
459 aEvent.State = mpCommand->GetState();
460 rxListener->statusChanged(aEvent);
464 const css::uno::Reference<css::frame::XStatusListener>& rxListener,
465 const css::util::URL& rURL)
467 if (rURL.Path != msURLPath)
470 StatusListenerContainer::iterator iListener (
472 maStatusListenerContainer.begin(),
473 maStatusListenerContainer.end(),
475 if (iListener != maStatusListenerContainer.end())
476 maStatusListenerContainer.erase(iListener);
482 const css::document::EventObject&)
484 mpCommand->GetState();
491 mbIsListeningToWindowManager =
false;
496 GotoPreviousSlideCommand::GotoPreviousSlideCommand (
502 void GotoPreviousSlideCommand::Execute()
513 bool GotoPreviousSlideCommand::IsEnabled()
const
526 GotoNextEffectCommand::GotoNextEffectCommand (
532 void GotoNextEffectCommand::Execute()
543 bool GotoNextEffectCommand::IsEnabled()
const
557 GotoNextSlideCommand::GotoNextSlideCommand (
563 void GotoNextSlideCommand::Execute()
576 SwitchMonitorCommand::SwitchMonitorCommand (
582 void SwitchMonitorCommand::Execute()
594 void PauseResumeCommand::Execute()
601 if ( ! pWindowManager.is())
605 if (!pPresentationTime)
608 if(pPresentationTime->isPaused())
610 pPresentationTime->setPauseStatus(
false);
611 pWindowManager->SetPauseState(
false);
615 pPresentationTime->setPauseStatus(
true);
616 pWindowManager->SetPauseState(
true);
620 Any PauseResumeCommand::GetState()
const
627 if ( ! pWindowManager.is())
632 return Any(pPresentationTime->isPaused());
643 void RestartTimerCommand::Execute()
650 if ( ! pWindowManager.is())
656 pPresentationTime->setPauseStatus(
false);
657 pWindowManager->SetPauseState(
false);
658 pPresentationTime->restart();
664 SetNotesViewCommand::SetNotesViewCommand (
672 void SetNotesViewCommand::Execute()
679 if ( ! pWindowManager.is())
688 Any SetNotesViewCommand::GetState()
const
695 if ( ! pWindowManager.is())
703 SetSlideSorterCommand::SetSlideSorterCommand (
711 void SetSlideSorterCommand::Execute()
718 if ( ! pWindowManager.is())
721 pWindowManager->SetSlideSorterState(
mbOn);
724 Any SetSlideSorterCommand::GetState()
const
731 if ( ! pWindowManager.is())
739 SetHelpViewCommand::SetHelpViewCommand (
747 void SetHelpViewCommand::Execute()
754 if ( ! pWindowManager.is())
757 pWindowManager->SetHelpViewState(
mbOn);
760 Any SetHelpViewCommand::GetState()
const
767 if ( ! pWindowManager.is())
775 NotesFontSizeCommand::NotesFontSizeCommand(
777 const sal_Int32 nSizeChange)
794 return dynamic_cast<PresenterNotesView*
>(pDescriptor->mxView.get());
797 void NotesFontSizeCommand::Execute()
804 Any NotesFontSizeCommand::GetState()
const
816 void ExitPresenterCommand::Execute()
static::rtl::Reference< PresenterController > Instance(const css::uno::Reference< css::frame::XFrame > &rxFrame)
virtual void SAL_CALL removeStatusListener(const css::uno::Reference< css::frame::XStatusListener > &rxListener, const css::util::URL &rURL) override
Reference< XFrame > xFrame
css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
mutable::osl::Mutex m_aMutex
virtual void SAL_CALL dispatch(const css::util::URL &aURL, const css::uno::Sequence< css::beans::PropertyValue > &rArguments) override
static constexpr OUStringLiteral msNotesViewURL
::cppu::WeakComponentImplHelper< css::lang::XInitialization, css::lang::XServiceInfo, css::util::XCacheInfo, css::frame::XDispatchProvider > PresenterProtocolHandlerInterfaceBase
static Reference< frame::XDispatch > Create(const OUString &rsURLPath, const ::rtl::Reference< PresenterController > &rpPresenterController)
Create a new Dispatch object.
static Command * CreateCommand(const OUString &rsURLPath, const ::rtl::Reference< PresenterController > &rpPresenterController)
::rtl::Reference< PresenterController > mpPresenterController
bool mbIsListeningToWindowManager
std::unique_ptr< Command > mpCommand
virtual ~PresenterProtocolHandler() override
Dispatch(const OUString &rsURLPath, const ::rtl::Reference< PresenterController > &rpPresenterController)
virtual ~Dispatch() override
PresenterProtocolHandler()
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
virtual void SAL_CALL addStatusListener(const css::uno::Reference< css::frame::XStatusListener > &rxListener, const css::util::URL &rURL) override
void SAL_CALL disposing() override
StatusListenerContainer maStatusListenerContainer
virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch(const css::util::URL &aURL, const OUString &aTargetFrameName, sal_Int32 nSearchFlags) override
const sal_Int32 mnSizeChange
void SAL_CALL disposing() override
virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any > &aArguments) override
::rtl::Reference< PresenterController > mpPresenterController
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * sdext_PresenterProtocolHandler_get_implementation(css::uno::XComponentContext *, css::uno::Sequence< css::uno::Any > const &)
Reference< XDispatch > xDispatch
rtl::Reference< PresenterController > mpPresenterController
virtual void SAL_CALL notifyEvent(const css::document::EventObject &rEvent) override
std::shared_ptr< PaneDescriptor > SharedPaneDescriptor
virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL queryDispatches(const css::uno::Sequence< css::frame::DispatchDescriptor > &rDescriptors) override
void ThrowIfDisposed() const
sal_Bool SAL_CALL supportsService(OUString const &ServiceName) override
OUString SAL_CALL getImplementationName() override
::std::vector< Reference< frame::XStatusListener > > StatusListenerContainer
bool m_bDetectedRangeSegmentation false