update dev300-m58
[ooovba.git] / sdext / source / presenter / PresenterProtocolHandler.cxx
blobe77b16f462667f7d322406d72878044d01b466f2
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: PresenterProtocolHandler.cxx,v $
11 * $Revision: 1.6 $
13 * This file is part of OpenOffice.org.
15 * OpenOffice.org is free software: you can redistribute it and/or modify
16 * it under the terms of the GNU Lesser General Public License version 3
17 * only, as published by the Free Software Foundation.
19 * OpenOffice.org is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU Lesser General Public License version 3 for more details
23 * (a copy is included in the LICENSE file that accompanied this code).
25 * You should have received a copy of the GNU Lesser General Public License
26 * version 3 along with OpenOffice.org. If not, see
27 * <http://www.openoffice.org/license.html>
28 * for a copy of the LGPLv3 License.
30 ************************************************************************/
32 // MARKER(update_precomp.py): autogen include statement, do not remove
33 #include "precompiled_sdext.hxx"
35 #include "PresenterProtocolHandler.hxx"
36 #include "PresenterConfigurationAccess.hxx"
37 #include "PresenterController.hxx"
38 #include "PresenterHelper.hxx"
39 #include "PresenterNotesView.hxx"
40 #include "PresenterPaneContainer.hxx"
41 #include "PresenterPaneFactory.hxx"
42 #include "PresenterViewFactory.hxx"
43 #include "PresenterWindowManager.hxx"
44 #include <com/sun/star/frame/XController.hpp>
45 #include <com/sun/star/drawing/SlideSorter.hpp>
46 #include <com/sun/star/drawing/framework/Configuration.hpp>
47 #include <com/sun/star/drawing/framework/XControllerManager.hpp>
48 #include <com/sun/star/drawing/framework/ResourceId.hpp>
49 #include <com/sun/star/drawing/framework/ResourceActivationMode.hpp>
50 #include <com/sun/star/presentation/XSlideShow.hpp>
51 #include <com/sun/star/presentation/XSlideShowView.hpp>
52 #include <com/sun/star/presentation/XPresentationSupplier.hpp>
53 #include <cppuhelper/compbase2.hxx>
54 #include <boost/bind.hpp>
55 #include <tools/debug.hxx>
57 using namespace ::com::sun::star;
58 using namespace ::com::sun::star::uno;
59 using namespace ::com::sun::star::drawing::framework;
60 using ::rtl::OUString;
62 #define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString)))
64 namespace sdext { namespace presenter {
66 namespace {
67 const static OUString gsProtocol (A2S("vnd.com.sun.star.comp.PresenterScreen:"));
69 class Command
71 public:
72 virtual void Execute (void) = 0;
73 virtual bool IsEnabled (void) const = 0;
74 virtual Any GetState (void) const = 0;
77 class GotoPreviousSlideCommand : public Command
79 public:
80 GotoPreviousSlideCommand (
81 const rtl::Reference<PresenterController>& rpPresenterController);
82 virtual ~GotoPreviousSlideCommand (void) {}
83 virtual void Execute (void);
84 virtual bool IsEnabled (void) const;
85 virtual Any GetState (void) const;
86 private:
87 rtl::Reference<PresenterController> mpPresenterController;
90 class GotoNextSlideCommand : public Command
92 public:
93 GotoNextSlideCommand (
94 const rtl::Reference<PresenterController>& rpPresenterController);
95 virtual ~GotoNextSlideCommand (void) {}
96 virtual void Execute (void);
97 virtual bool IsEnabled (void) const;
98 virtual Any GetState (void) const;
99 private:
100 rtl::Reference<PresenterController> mpPresenterController;
103 class GotoNextEffectCommand : public Command
105 public:
106 GotoNextEffectCommand (
107 const rtl::Reference<PresenterController>& rpPresenterController);
108 virtual ~GotoNextEffectCommand (void) {}
109 virtual void Execute (void);
110 virtual bool IsEnabled (void) const;
111 virtual Any GetState (void) const;
112 private:
113 rtl::Reference<PresenterController> mpPresenterController;
116 class SetNotesViewCommand : public Command
118 public:
119 SetNotesViewCommand (
120 const bool bOn,
121 const rtl::Reference<PresenterController>& rpPresenterController);
122 virtual ~SetNotesViewCommand (void) {}
123 virtual void Execute (void);
124 virtual bool IsEnabled (void) const;
125 virtual Any GetState (void) const;
126 private:
127 bool mbOn;
128 rtl::Reference<PresenterController> mpPresenterController;
129 bool IsActive (const ::rtl::Reference<PresenterWindowManager>& rpWindowManager) const;
132 class SetSlideSorterCommand : public Command
134 public:
135 SetSlideSorterCommand (
136 const bool bOn,
137 const rtl::Reference<PresenterController>& rpPresenterController);
138 virtual ~SetSlideSorterCommand (void) {}
139 virtual void Execute (void);
140 virtual bool IsEnabled (void) const;
141 virtual Any GetState (void) const;
142 private:
143 bool mbOn;
144 rtl::Reference<PresenterController> mpPresenterController;
147 class SetHelpViewCommand : public Command
149 public:
150 SetHelpViewCommand (
151 const bool bOn,
152 const rtl::Reference<PresenterController>& rpPresenterController);
153 virtual ~SetHelpViewCommand (void) {}
154 virtual void Execute (void);
155 virtual bool IsEnabled (void) const;
156 virtual Any GetState (void) const;
157 private:
158 bool mbOn;
159 rtl::Reference<PresenterController> mpPresenterController;
162 class NotesFontSizeCommand : public Command
164 public:
165 NotesFontSizeCommand(
166 const rtl::Reference<PresenterController>& rpPresenterController,
167 const sal_Int32 nSizeChange);
168 virtual ~NotesFontSizeCommand (void) {}
169 virtual void Execute (void);
170 virtual bool IsEnabled (void) const;
171 virtual Any GetState (void) const;
172 protected:
173 ::rtl::Reference<PresenterNotesView> GetNotesView (void) const;
174 private:
175 rtl::Reference<PresenterController> mpPresenterController;
176 const sal_Int32 mnSizeChange;
179 } // end of anonymous namespace
182 namespace {
183 typedef ::cppu::WeakComponentImplHelper2 <
184 css::frame::XDispatch,
185 css::document::XEventListener
186 > PresenterDispatchInterfaceBase;
189 class PresenterProtocolHandler::Dispatch
190 : protected ::cppu::BaseMutex,
191 public PresenterDispatchInterfaceBase
193 public:
194 typedef void (PresenterProtocolHandler::Dispatch::* Action)(void);
196 /** Create a new Dispatch object. When the given command name
197 (rsURLPath) is not known then an empty reference is returned.
199 static Reference<frame::XDispatch> Create (
200 const OUString& rsURLPath,
201 const ::rtl::Reference<PresenterController>& rpPresenterController);
203 void SAL_CALL disposing (void);
204 static Command* CreateCommand (
205 const OUString& rsURLPath,
206 const ::rtl::Reference<PresenterController>& rpPresenterController);
209 // XDispatch
210 virtual void SAL_CALL dispatch(
211 const css::util::URL& aURL,
212 const css::uno::Sequence<css::beans::PropertyValue>& rArguments)
213 throw(css::uno::RuntimeException);
215 virtual void SAL_CALL addStatusListener(
216 const css::uno::Reference<css::frame::XStatusListener>& rxListener,
217 const css::util::URL& rURL)
218 throw(css::uno::RuntimeException);
220 virtual void SAL_CALL removeStatusListener (
221 const css::uno::Reference<css::frame::XStatusListener>& rxListener,
222 const css::util::URL& rURL)
223 throw(css::uno::RuntimeException);
226 // document::XEventListener
228 virtual void SAL_CALL notifyEvent (const css::document::EventObject& rEvent)
229 throw(css::uno::RuntimeException);
232 // lang::XEventListener
234 virtual void SAL_CALL disposing (const css::lang::EventObject& rEvent)
235 throw(css::uno::RuntimeException);
237 private:
238 OUString msURLPath;
239 ::boost::scoped_ptr<Command> mpCommand;
240 ::rtl::Reference<PresenterController> mpPresenterController;
241 typedef ::std::vector<Reference<frame::XStatusListener> > StatusListenerContainer;
242 StatusListenerContainer maStatusListenerContainer;
243 bool mbIsListeningToWindowManager;
245 Dispatch (
246 const OUString& rsURLPath,
247 const ::rtl::Reference<PresenterController>& rpPresenterController);
248 virtual ~Dispatch (void);
250 void ThrowIfDisposed (void) const throw (css::lang::DisposedException);
256 //----- Service ---------------------------------------------------------------
258 OUString PresenterProtocolHandler::getImplementationName_static (void)
260 return A2S("vnd.sun.star.sdext.presenter.PresenterProtocolHandler");
266 Sequence<OUString> PresenterProtocolHandler::getSupportedServiceNames_static (void)
268 static const ::rtl::OUString sServiceName(A2S("com.sun.star.frame.ProtocolHandler"));
269 return Sequence<rtl::OUString>(&sServiceName, 1);
275 Reference<XInterface> PresenterProtocolHandler::Create (
276 const Reference<uno::XComponentContext>& rxContext)
277 SAL_THROW((Exception))
279 return Reference<XInterface>(static_cast<XWeak*>(new PresenterProtocolHandler(rxContext)));
285 //===== PresenterProtocolHandler =========================================================
288 PresenterProtocolHandler::PresenterProtocolHandler (const Reference<XComponentContext>& rxContext)
289 : PresenterProtocolHandlerInterfaceBase(m_aMutex)
291 (void)rxContext;
297 PresenterProtocolHandler::~PresenterProtocolHandler (void)
304 void SAL_CALL PresenterProtocolHandler::disposing (void)
311 //----- XInitialize -----------------------------------------------------------
313 void SAL_CALL PresenterProtocolHandler::initialize (const Sequence<Any>& aArguments)
314 throw (Exception, RuntimeException)
316 ThrowIfDisposed();
317 if (aArguments.getLength() > 0)
321 Reference<frame::XFrame> xFrame;
322 if (aArguments[0] >>= xFrame)
324 mpPresenterController = PresenterController::Instance(xFrame);
327 catch (RuntimeException&)
329 OSL_ASSERT(false);
337 //----- XDispatchProvider -----------------------------------------------------
339 Reference<frame::XDispatch> SAL_CALL PresenterProtocolHandler::queryDispatch (
340 const css::util::URL& rURL,
341 const rtl::OUString& rsTargetFrameName,
342 sal_Int32 nSearchFlags)
343 throw(RuntimeException)
345 (void)rsTargetFrameName;
346 (void)nSearchFlags;
347 ThrowIfDisposed();
349 Reference<frame::XDispatch> xDispatch;
351 if (rURL.Protocol == gsProtocol)
353 xDispatch.set(Dispatch::Create(rURL.Path, mpPresenterController));
356 return xDispatch;
362 Sequence<Reference<frame::XDispatch> > SAL_CALL PresenterProtocolHandler::queryDispatches(
363 const Sequence<frame::DispatchDescriptor>& rDescriptors)
364 throw(RuntimeException)
366 (void)rDescriptors;
367 ThrowIfDisposed();
368 return Sequence<Reference<frame::XDispatch> >();
374 //-----------------------------------------------------------------------------
376 void PresenterProtocolHandler::ThrowIfDisposed (void) const
377 throw (::com::sun::star::lang::DisposedException)
379 if (rBHelper.bDisposed || rBHelper.bInDispose)
381 throw lang::DisposedException (
382 OUString(RTL_CONSTASCII_USTRINGPARAM(
383 "PresenterProtocolHandler object has already been disposed")),
384 const_cast<uno::XWeak*>(static_cast<const uno::XWeak*>(this)));
391 //===== PresenterProtocolHandler::Dispatch ====================================
393 Reference<frame::XDispatch> PresenterProtocolHandler::Dispatch::Create (
394 const OUString& rsURLPath,
395 const ::rtl::Reference<PresenterController>& rpPresenterController)
397 ::rtl::Reference<Dispatch> pDispatch (new Dispatch (rsURLPath, rpPresenterController));
398 if (pDispatch->mpCommand.get() != NULL)
399 return Reference<frame::XDispatch>(pDispatch.get());
400 else
401 return NULL;
407 PresenterProtocolHandler::Dispatch::Dispatch (
408 const OUString& rsURLPath,
409 const ::rtl::Reference<PresenterController>& rpPresenterController)
410 : PresenterDispatchInterfaceBase(m_aMutex),
411 msURLPath(rsURLPath),
412 mpCommand(CreateCommand(rsURLPath, rpPresenterController)),
413 mpPresenterController(rpPresenterController),
414 maStatusListenerContainer(),
415 mbIsListeningToWindowManager(false)
417 if (mpCommand.get() != NULL)
419 mpPresenterController->GetWindowManager()->AddLayoutListener(this);
420 mbIsListeningToWindowManager = true;
427 Command* PresenterProtocolHandler::Dispatch::CreateCommand (
428 const OUString& rsURLPath,
429 const ::rtl::Reference<PresenterController>& rpPresenterController)
431 if (rsURLPath.getLength() <= 5)
432 return NULL;
433 switch (rsURLPath[0])
435 case sal_Char('C') :
436 switch (rsURLPath[5])
438 case sal_Char('N'):
439 if (rsURLPath == A2S("CloseNotes"))
440 return new SetNotesViewCommand(false, rpPresenterController);
441 break;
442 case sal_Char('S'):
443 if (rsURLPath == A2S("CloseSlideSorter"))
444 return new SetSlideSorterCommand(false, rpPresenterController);
445 break;
446 case sal_Char('H'):
447 if (rsURLPath == A2S("CloseHelp"))
448 return new SetHelpViewCommand(false, rpPresenterController);
449 break;
451 break;
452 case sal_Char('G') :
453 if (rsURLPath == A2S("GrowNotesFont"))
454 return new NotesFontSizeCommand(rpPresenterController, +1);
455 break;
457 case sal_Char('N') :
458 switch (rsURLPath[4])
460 case sal_Char('E'):
461 if (rsURLPath == A2S("NextEffect"))
462 return new GotoNextEffectCommand(rpPresenterController);
463 case sal_Char('S'):
464 if (rsURLPath == A2S("NextSlide"))
465 return new GotoNextSlideCommand(rpPresenterController);
466 break;
468 break;
470 case sal_Char('P') :
471 if (rsURLPath == A2S("PrevSlide"))
472 return new GotoPreviousSlideCommand(rpPresenterController);
473 break;
475 case sal_Char('S') :
476 switch (rsURLPath[4])
478 case sal_Char('N'):
479 if (rsURLPath == A2S("ShowNotes"))
480 return new SetNotesViewCommand(true, rpPresenterController);
481 break;
483 case sal_Char('S'):
484 if (rsURLPath == A2S("ShowSlideSorter"))
485 return new SetSlideSorterCommand(true, rpPresenterController);
486 break;
488 case sal_Char('H'):
489 if (rsURLPath == A2S("ShowHelp"))
490 return new SetHelpViewCommand(true, rpPresenterController);
491 break;
493 case sal_Char('n'):
494 if (rsURLPath == A2S("ShrinkNotesFont"))
495 return new NotesFontSizeCommand(rpPresenterController, -1);
496 break;
498 break;
500 default:
501 break;
504 return NULL;
510 PresenterProtocolHandler::Dispatch::~Dispatch (void)
517 void PresenterProtocolHandler::Dispatch::disposing (void)
519 if (mbIsListeningToWindowManager)
521 if (mpPresenterController.get() != NULL)
522 mpPresenterController->GetWindowManager()->RemoveLayoutListener(this);
523 mbIsListeningToWindowManager = false;
526 msURLPath = OUString();
527 mpCommand.reset();
533 //----- XDispatch -------------------------------------------------------------
535 void SAL_CALL PresenterProtocolHandler::Dispatch::dispatch(
536 const css::util::URL& rURL,
537 const css::uno::Sequence<css::beans::PropertyValue>& rArguments)
538 throw(css::uno::RuntimeException)
540 (void)rArguments;
541 ThrowIfDisposed();
543 if (rURL.Protocol == gsProtocol
544 && rURL.Path == msURLPath)
546 if (mpCommand.get() != NULL)
547 mpCommand->Execute();
549 else
551 // We can not throw an IllegalArgumentException
552 throw RuntimeException();
559 void SAL_CALL PresenterProtocolHandler::Dispatch::addStatusListener(
560 const css::uno::Reference<css::frame::XStatusListener>& rxListener,
561 const css::util::URL& rURL)
562 throw(css::uno::RuntimeException)
564 if (rURL.Path == msURLPath)
566 maStatusListenerContainer.push_back(rxListener);
568 frame::FeatureStateEvent aEvent;
569 aEvent.FeatureURL = rURL;
570 aEvent.IsEnabled = mpCommand->IsEnabled();
571 aEvent.Requery = sal_False;
572 aEvent.State = mpCommand->GetState();
573 rxListener->statusChanged(aEvent);
575 else
576 throw RuntimeException();
582 void SAL_CALL PresenterProtocolHandler::Dispatch::removeStatusListener (
583 const css::uno::Reference<css::frame::XStatusListener>& rxListener,
584 const css::util::URL& rURL)
585 throw(css::uno::RuntimeException)
587 if (rURL.Path == msURLPath)
589 StatusListenerContainer::iterator iListener (
590 ::std::find(
591 maStatusListenerContainer.begin(),
592 maStatusListenerContainer.end(),
593 rxListener));
594 if (iListener != maStatusListenerContainer.end())
595 maStatusListenerContainer.erase(iListener);
597 else
598 throw RuntimeException();
604 //-----------------------------------------------------------------------------
606 void PresenterProtocolHandler::Dispatch::ThrowIfDisposed (void) const
607 throw (::com::sun::star::lang::DisposedException)
609 if (rBHelper.bDisposed || rBHelper.bInDispose)
611 throw lang::DisposedException (
612 OUString(RTL_CONSTASCII_USTRINGPARAM(
613 "PresenterProtocolHandler::Dispatch object has already been disposed")),
614 const_cast<uno::XWeak*>(static_cast<const uno::XWeak*>(this)));
621 //----- document::XEventListener ----------------------------------------------
623 void SAL_CALL PresenterProtocolHandler::Dispatch::notifyEvent (
624 const css::document::EventObject& rEvent)
625 throw(css::uno::RuntimeException)
627 (void)rEvent;
629 mpCommand->GetState();
635 //----- lang::XEventListener --------------------------------------------------
637 void SAL_CALL PresenterProtocolHandler::Dispatch::disposing (const css::lang::EventObject& rEvent)
638 throw(css::uno::RuntimeException)
640 (void)rEvent;
641 mbIsListeningToWindowManager = false;
648 //===== GotoPreviousSlideCommand ==============================================
650 GotoPreviousSlideCommand::GotoPreviousSlideCommand (
651 const rtl::Reference<PresenterController>& rpPresenterController)
652 : mpPresenterController(rpPresenterController)
658 void GotoPreviousSlideCommand::Execute (void)
660 if ( ! mpPresenterController.is())
661 return;
663 if ( ! mpPresenterController->GetSlideShowController().is())
664 return;
666 mpPresenterController->GetSlideShowController()->gotoPreviousSlide();
672 bool GotoPreviousSlideCommand::IsEnabled (void) const
674 if ( ! mpPresenterController.is())
675 return false;
677 if ( ! mpPresenterController->GetSlideShowController().is())
678 return false;
680 return mpPresenterController->GetSlideShowController()->getCurrentSlideIndex()>0;
686 Any GotoPreviousSlideCommand::GetState (void) const
688 return Any(sal_False);
694 //===== GotoNextEffect ========================================================
696 GotoNextEffectCommand::GotoNextEffectCommand (
697 const rtl::Reference<PresenterController>& rpPresenterController)
698 : mpPresenterController(rpPresenterController)
704 void GotoNextEffectCommand::Execute (void)
706 if ( ! mpPresenterController.is())
707 return;
709 if ( ! mpPresenterController->GetSlideShowController().is())
710 return;
712 mpPresenterController->GetSlideShowController()->gotoNextEffect();
718 bool GotoNextEffectCommand::IsEnabled (void) const
720 // The next slide command is always enabled, even when the current slide
721 // is the last slide: from the last slide it goes to the pause slide,
722 // and from there it ends the slide show.
723 return true;
729 Any GotoNextEffectCommand::GetState (void) const
731 return Any(sal_False);
737 //===== GotoNextSlide =========================================================
739 GotoNextSlideCommand::GotoNextSlideCommand (
740 const rtl::Reference<PresenterController>& rpPresenterController)
741 : mpPresenterController(rpPresenterController)
747 void GotoNextSlideCommand::Execute (void)
749 if ( ! mpPresenterController.is())
750 return;
752 if ( ! mpPresenterController->GetSlideShowController().is())
753 return;
755 mpPresenterController->GetSlideShowController()->gotoNextSlide();
761 bool GotoNextSlideCommand::IsEnabled (void) const
763 // The next slide command is always enabled, even when the current slide
764 // is the last slide: from the last slide it goes to the pause slide,
765 // and from there it ends the slide show.
766 return true;
772 Any GotoNextSlideCommand::GetState (void) const
774 return Any(sal_False);
780 //===== SetNotesViewCommand ===================================================
782 SetNotesViewCommand::SetNotesViewCommand (
783 const bool bOn,
784 const rtl::Reference<PresenterController>& rpPresenterController)
785 : mbOn(bOn),
786 mpPresenterController(rpPresenterController)
793 void SetNotesViewCommand::Execute (void)
795 if ( ! mpPresenterController.is())
796 return;
798 ::rtl::Reference<PresenterWindowManager> pWindowManager (
799 mpPresenterController->GetWindowManager());
800 if ( ! pWindowManager.is())
801 return;
803 if (mbOn)
804 pWindowManager->SetLayoutMode(PresenterWindowManager::Notes);
805 else
806 pWindowManager->SetLayoutMode(PresenterWindowManager::Standard);
812 bool SetNotesViewCommand::IsEnabled (void) const
814 return true;
820 Any SetNotesViewCommand::GetState (void) const
822 if ( ! mpPresenterController.is())
823 return Any(false);
825 ::rtl::Reference<PresenterWindowManager> pWindowManager (
826 mpPresenterController->GetWindowManager());
827 if ( ! pWindowManager.is())
828 return Any(false);
830 return Any(IsActive(pWindowManager));
836 bool SetNotesViewCommand::IsActive (
837 const ::rtl::Reference<PresenterWindowManager>& rpWindowManager) const
839 return rpWindowManager->GetLayoutMode() == PresenterWindowManager::Notes
840 && !rpWindowManager->IsSlideSorterActive()
841 && !rpWindowManager->IsHelpViewActive();
847 //===== SetSlideSorterCommand =================================================
849 SetSlideSorterCommand::SetSlideSorterCommand (
850 const bool bOn,
851 const rtl::Reference<PresenterController>& rpPresenterController)
852 : mbOn(bOn),
853 mpPresenterController(rpPresenterController)
860 void SetSlideSorterCommand::Execute (void)
862 if ( ! mpPresenterController.is())
863 return;
865 ::rtl::Reference<PresenterWindowManager> pWindowManager (
866 mpPresenterController->GetWindowManager());
867 if ( ! pWindowManager.is())
868 return;
870 pWindowManager->SetSlideSorterState(mbOn);
876 bool SetSlideSorterCommand::IsEnabled (void) const
878 return true;
884 Any SetSlideSorterCommand::GetState (void) const
886 if ( ! mpPresenterController.is())
887 return Any(false);
889 ::rtl::Reference<PresenterWindowManager> pWindowManager (
890 mpPresenterController->GetWindowManager());
891 if ( ! pWindowManager.is())
892 return Any(false);
894 return Any(pWindowManager->IsSlideSorterActive());
900 //===== SetHelpViewCommand ===================================================
902 SetHelpViewCommand::SetHelpViewCommand (
903 const bool bOn,
904 const rtl::Reference<PresenterController>& rpPresenterController)
905 : mbOn(bOn),
906 mpPresenterController(rpPresenterController)
913 void SetHelpViewCommand::Execute (void)
915 if ( ! mpPresenterController.is())
916 return;
918 ::rtl::Reference<PresenterWindowManager> pWindowManager (
919 mpPresenterController->GetWindowManager());
920 if ( ! pWindowManager.is())
921 return;
923 pWindowManager->SetHelpViewState(mbOn);
929 bool SetHelpViewCommand::IsEnabled (void) const
931 return true;
937 Any SetHelpViewCommand::GetState (void) const
939 if ( ! mpPresenterController.is())
940 return Any(false);
942 ::rtl::Reference<PresenterWindowManager> pWindowManager (
943 mpPresenterController->GetWindowManager());
944 if ( ! pWindowManager.is())
945 return Any(false);
947 return Any(pWindowManager->IsHelpViewActive());
953 //===== NotesFontSizeCommand ==================================================
955 NotesFontSizeCommand::NotesFontSizeCommand(
956 const rtl::Reference<PresenterController>& rpPresenterController,
957 const sal_Int32 nSizeChange)
958 : mpPresenterController(rpPresenterController),
959 mnSizeChange(nSizeChange)
966 ::rtl::Reference<PresenterNotesView> NotesFontSizeCommand::GetNotesView (void) const
968 if (mpPresenterController.get() == NULL)
969 return NULL;
971 PresenterPaneContainer::SharedPaneDescriptor pDescriptor (
972 mpPresenterController->GetPaneContainer()->FindViewURL(
973 PresenterViewFactory::msNotesViewURL));
974 if (pDescriptor.get() == NULL)
975 return NULL;
977 return dynamic_cast<PresenterNotesView*>(pDescriptor->mxView.get());
983 void NotesFontSizeCommand::Execute (void)
985 ::rtl::Reference<PresenterNotesView> pView (GetNotesView());
986 if (pView.is())
987 pView->ChangeFontSize(mnSizeChange);
993 bool NotesFontSizeCommand::IsEnabled (void) const
995 return true;
1001 Any NotesFontSizeCommand::GetState (void) const
1003 return Any();
1007 } } // end of namespace ::sdext::presenter