ie. void f(void); becomes void f(); I used the following command to make the changes: git grep -lP '\(\s*void\s*\)' -- *.cxx \ | xargs perl -pi -w -e 's/(\w+)\s*\(\s*void\s*\)/$1\(\)/g;' and ran it for both .cxx and .hxx files. Change-Id: I314a1b56e9c14d10726e32841736b0ad5eef8ddd
770 lines
24 KiB
C++
770 lines
24 KiB
C++
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
/*
|
|
* This file is part of the LibreOffice project.
|
|
*
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
*
|
|
* This file incorporates work covered by the following license notice:
|
|
*
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
* with this work for additional information regarding copyright
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
* except in compliance with the License. You may obtain a copy of
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
*/
|
|
|
|
#include "PresenterProtocolHandler.hxx"
|
|
#include "PresenterConfigurationAccess.hxx"
|
|
#include "PresenterController.hxx"
|
|
#include "PresenterHelper.hxx"
|
|
#include "PresenterNotesView.hxx"
|
|
#include "PresenterPaneContainer.hxx"
|
|
#include "PresenterPaneFactory.hxx"
|
|
#include "PresenterViewFactory.hxx"
|
|
#include "PresenterWindowManager.hxx"
|
|
#include <com/sun/star/frame/XController.hpp>
|
|
#include <com/sun/star/drawing/SlideSorter.hpp>
|
|
#include <com/sun/star/drawing/framework/Configuration.hpp>
|
|
#include <com/sun/star/drawing/framework/XControllerManager.hpp>
|
|
#include <com/sun/star/drawing/framework/ResourceId.hpp>
|
|
#include <com/sun/star/drawing/framework/ResourceActivationMode.hpp>
|
|
#include <com/sun/star/presentation/XSlideShow.hpp>
|
|
#include <com/sun/star/presentation/XSlideShowView.hpp>
|
|
#include <com/sun/star/presentation/XPresentationSupplier.hpp>
|
|
#include <cppuhelper/compbase2.hxx>
|
|
#include <cppuhelper/supportsservice.hxx>
|
|
|
|
using namespace ::com::sun::star;
|
|
using namespace ::com::sun::star::uno;
|
|
using namespace ::com::sun::star::drawing::framework;
|
|
|
|
namespace sdext { namespace presenter {
|
|
|
|
namespace {
|
|
class Command
|
|
{
|
|
public:
|
|
virtual ~Command() {}
|
|
virtual void Execute() = 0;
|
|
virtual bool IsEnabled() const { return true; }
|
|
virtual Any GetState() const { return Any(sal_False); }
|
|
};
|
|
|
|
class GotoPreviousSlideCommand : public Command
|
|
{
|
|
public:
|
|
GotoPreviousSlideCommand (
|
|
const rtl::Reference<PresenterController>& rpPresenterController);
|
|
virtual ~GotoPreviousSlideCommand() {}
|
|
virtual void Execute() SAL_OVERRIDE;
|
|
virtual bool IsEnabled() const SAL_OVERRIDE;
|
|
private:
|
|
rtl::Reference<PresenterController> mpPresenterController;
|
|
};
|
|
|
|
class GotoNextSlideCommand : public Command
|
|
{
|
|
public:
|
|
GotoNextSlideCommand (
|
|
const rtl::Reference<PresenterController>& rpPresenterController);
|
|
virtual ~GotoNextSlideCommand() {}
|
|
virtual void Execute() SAL_OVERRIDE;
|
|
// The next slide command is always enabled, even when the current slide
|
|
// is the last slide: from the last slide it goes to the pause slide,
|
|
// and from there it ends the slide show.
|
|
virtual bool IsEnabled() const SAL_OVERRIDE { return true; }
|
|
private:
|
|
rtl::Reference<PresenterController> mpPresenterController;
|
|
};
|
|
|
|
class GotoNextEffectCommand : public Command
|
|
{
|
|
public:
|
|
GotoNextEffectCommand (
|
|
const rtl::Reference<PresenterController>& rpPresenterController);
|
|
virtual ~GotoNextEffectCommand() {}
|
|
virtual void Execute() SAL_OVERRIDE;
|
|
private:
|
|
rtl::Reference<PresenterController> mpPresenterController;
|
|
};
|
|
|
|
class SwitchMonitorCommand : public Command
|
|
{
|
|
public:
|
|
SwitchMonitorCommand (
|
|
const rtl::Reference<PresenterController>& rpPresenterController);
|
|
virtual ~SwitchMonitorCommand() {}
|
|
virtual void Execute() SAL_OVERRIDE;
|
|
private:
|
|
rtl::Reference<PresenterController> mpPresenterController;
|
|
};
|
|
|
|
class SetNotesViewCommand : public Command
|
|
{
|
|
public:
|
|
SetNotesViewCommand (
|
|
const bool bOn,
|
|
const rtl::Reference<PresenterController>& rpPresenterController);
|
|
virtual ~SetNotesViewCommand() {}
|
|
virtual void Execute() SAL_OVERRIDE;
|
|
virtual Any GetState() const SAL_OVERRIDE;
|
|
private:
|
|
bool mbOn;
|
|
rtl::Reference<PresenterController> mpPresenterController;
|
|
static bool IsActive (const ::rtl::Reference<PresenterWindowManager>& rpWindowManager);
|
|
};
|
|
|
|
class SetSlideSorterCommand : public Command
|
|
{
|
|
public:
|
|
SetSlideSorterCommand (
|
|
const bool bOn,
|
|
const rtl::Reference<PresenterController>& rpPresenterController);
|
|
virtual ~SetSlideSorterCommand() {}
|
|
virtual void Execute() SAL_OVERRIDE;
|
|
virtual Any GetState() const SAL_OVERRIDE;
|
|
private:
|
|
bool mbOn;
|
|
rtl::Reference<PresenterController> mpPresenterController;
|
|
};
|
|
|
|
class SetHelpViewCommand : public Command
|
|
{
|
|
public:
|
|
SetHelpViewCommand (
|
|
const bool bOn,
|
|
const rtl::Reference<PresenterController>& rpPresenterController);
|
|
virtual ~SetHelpViewCommand() {}
|
|
virtual void Execute() SAL_OVERRIDE;
|
|
virtual Any GetState() const SAL_OVERRIDE;
|
|
private:
|
|
bool mbOn;
|
|
rtl::Reference<PresenterController> mpPresenterController;
|
|
};
|
|
|
|
class NotesFontSizeCommand : public Command
|
|
{
|
|
public:
|
|
NotesFontSizeCommand(
|
|
const rtl::Reference<PresenterController>& rpPresenterController,
|
|
const sal_Int32 nSizeChange);
|
|
virtual ~NotesFontSizeCommand() {}
|
|
virtual void Execute() SAL_OVERRIDE;
|
|
virtual Any GetState() const SAL_OVERRIDE;
|
|
protected:
|
|
::rtl::Reference<PresenterNotesView> GetNotesView() const;
|
|
private:
|
|
rtl::Reference<PresenterController> mpPresenterController;
|
|
const sal_Int32 mnSizeChange;
|
|
};
|
|
|
|
} // end of anonymous namespace
|
|
|
|
namespace {
|
|
typedef ::cppu::WeakComponentImplHelper2 <
|
|
css::frame::XDispatch,
|
|
css::document::XEventListener
|
|
> PresenterDispatchInterfaceBase;
|
|
}
|
|
|
|
class PresenterProtocolHandler::Dispatch
|
|
: protected ::cppu::BaseMutex,
|
|
public PresenterDispatchInterfaceBase
|
|
{
|
|
public:
|
|
typedef void (PresenterProtocolHandler::Dispatch::* Action)(void);
|
|
|
|
/** Create a new Dispatch object. When the given command name
|
|
(rsURLPath) is not known then an empty reference is returned.
|
|
*/
|
|
static Reference<frame::XDispatch> Create (
|
|
const OUString& rsURLPath,
|
|
const ::rtl::Reference<PresenterController>& rpPresenterController);
|
|
|
|
void SAL_CALL disposing() SAL_OVERRIDE;
|
|
static Command* CreateCommand (
|
|
const OUString& rsURLPath,
|
|
const ::rtl::Reference<PresenterController>& rpPresenterController);
|
|
|
|
// XDispatch
|
|
virtual void SAL_CALL dispatch(
|
|
const css::util::URL& aURL,
|
|
const css::uno::Sequence<css::beans::PropertyValue>& rArguments)
|
|
throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
|
|
|
|
virtual void SAL_CALL addStatusListener(
|
|
const css::uno::Reference<css::frame::XStatusListener>& rxListener,
|
|
const css::util::URL& rURL)
|
|
throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
|
|
|
|
virtual void SAL_CALL removeStatusListener (
|
|
const css::uno::Reference<css::frame::XStatusListener>& rxListener,
|
|
const css::util::URL& rURL)
|
|
throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
|
|
|
|
// document::XEventListener
|
|
|
|
virtual void SAL_CALL notifyEvent (const css::document::EventObject& rEvent)
|
|
throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
|
|
|
|
// lang::XEventListener
|
|
|
|
virtual void SAL_CALL disposing (const css::lang::EventObject& rEvent)
|
|
throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
|
|
|
|
private:
|
|
OUString msURLPath;
|
|
::boost::scoped_ptr<Command> mpCommand;
|
|
::rtl::Reference<PresenterController> mpPresenterController;
|
|
typedef ::std::vector<Reference<frame::XStatusListener> > StatusListenerContainer;
|
|
StatusListenerContainer maStatusListenerContainer;
|
|
bool mbIsListeningToWindowManager;
|
|
|
|
Dispatch (
|
|
const OUString& rsURLPath,
|
|
const ::rtl::Reference<PresenterController>& rpPresenterController);
|
|
virtual ~Dispatch();
|
|
|
|
void ThrowIfDisposed() const throw (css::lang::DisposedException);
|
|
};
|
|
|
|
//----- Service ---------------------------------------------------------------
|
|
|
|
OUString PresenterProtocolHandler::getImplementationName_static()
|
|
{
|
|
return OUString("org.libreoffice.comp.PresenterScreenProtocolHandler");
|
|
}
|
|
|
|
Sequence<OUString> PresenterProtocolHandler::getSupportedServiceNames_static()
|
|
{
|
|
static const OUString sServiceName("com.sun.star.frame.ProtocolHandler");
|
|
return Sequence<OUString>(&sServiceName, 1);
|
|
}
|
|
|
|
Reference<XInterface> PresenterProtocolHandler::Create (
|
|
const Reference<uno::XComponentContext>& rxContext)
|
|
{
|
|
return Reference<XInterface>(static_cast<XWeak*>(new PresenterProtocolHandler(rxContext)));
|
|
}
|
|
|
|
//===== PresenterProtocolHandler =========================================================
|
|
|
|
PresenterProtocolHandler::PresenterProtocolHandler (const Reference<XComponentContext>& rxContext)
|
|
: PresenterProtocolHandlerInterfaceBase(m_aMutex)
|
|
{
|
|
(void)rxContext;
|
|
}
|
|
|
|
PresenterProtocolHandler::~PresenterProtocolHandler()
|
|
{
|
|
}
|
|
|
|
void SAL_CALL PresenterProtocolHandler::disposing()
|
|
{
|
|
}
|
|
|
|
//----- XInitialize -----------------------------------------------------------
|
|
|
|
void SAL_CALL PresenterProtocolHandler::initialize (const Sequence<Any>& aArguments)
|
|
throw (Exception, RuntimeException, std::exception)
|
|
{
|
|
ThrowIfDisposed();
|
|
if (aArguments.getLength() > 0)
|
|
{
|
|
try
|
|
{
|
|
Reference<frame::XFrame> xFrame;
|
|
if (aArguments[0] >>= xFrame)
|
|
{
|
|
mpPresenterController = PresenterController::Instance(xFrame);
|
|
}
|
|
}
|
|
catch (RuntimeException&)
|
|
{
|
|
OSL_ASSERT(false);
|
|
}
|
|
}
|
|
}
|
|
|
|
OUString PresenterProtocolHandler::getImplementationName()
|
|
throw (css::uno::RuntimeException, std::exception)
|
|
{
|
|
return getImplementationName_static();
|
|
}
|
|
|
|
sal_Bool PresenterProtocolHandler::supportsService(OUString const & ServiceName)
|
|
throw (css::uno::RuntimeException, std::exception)
|
|
{
|
|
return cppu::supportsService(this, ServiceName);
|
|
}
|
|
|
|
css::uno::Sequence<OUString>
|
|
PresenterProtocolHandler::getSupportedServiceNames()
|
|
throw (css::uno::RuntimeException, std::exception)
|
|
{
|
|
return getSupportedServiceNames_static();
|
|
}
|
|
|
|
//----- XDispatchProvider -----------------------------------------------------
|
|
|
|
Reference<frame::XDispatch> SAL_CALL PresenterProtocolHandler::queryDispatch (
|
|
const css::util::URL& rURL,
|
|
const OUString& rsTargetFrameName,
|
|
sal_Int32 nSearchFlags)
|
|
throw(RuntimeException, std::exception)
|
|
{
|
|
(void)rsTargetFrameName;
|
|
(void)nSearchFlags;
|
|
ThrowIfDisposed();
|
|
|
|
Reference<frame::XDispatch> xDispatch;
|
|
|
|
if (rURL.Protocol == "vnd.org.libreoffice.presenterscreen:")
|
|
{
|
|
xDispatch.set(Dispatch::Create(rURL.Path, mpPresenterController));
|
|
}
|
|
|
|
return xDispatch;
|
|
}
|
|
|
|
Sequence<Reference<frame::XDispatch> > SAL_CALL PresenterProtocolHandler::queryDispatches(
|
|
const Sequence<frame::DispatchDescriptor>& rDescriptors)
|
|
throw(RuntimeException, std::exception)
|
|
{
|
|
(void)rDescriptors;
|
|
ThrowIfDisposed();
|
|
return Sequence<Reference<frame::XDispatch> >();
|
|
}
|
|
|
|
|
|
|
|
void PresenterProtocolHandler::ThrowIfDisposed() const
|
|
throw (::com::sun::star::lang::DisposedException)
|
|
{
|
|
if (rBHelper.bDisposed || rBHelper.bInDispose)
|
|
{
|
|
throw lang::DisposedException (
|
|
OUString(
|
|
"PresenterProtocolHandler object has already been disposed"),
|
|
const_cast<uno::XWeak*>(static_cast<const uno::XWeak*>(this)));
|
|
}
|
|
}
|
|
|
|
//===== PresenterProtocolHandler::Dispatch ====================================
|
|
|
|
Reference<frame::XDispatch> PresenterProtocolHandler::Dispatch::Create (
|
|
const OUString& rsURLPath,
|
|
const ::rtl::Reference<PresenterController>& rpPresenterController)
|
|
{
|
|
::rtl::Reference<Dispatch> pDispatch (new Dispatch (rsURLPath, rpPresenterController));
|
|
if (pDispatch->mpCommand.get() != NULL)
|
|
return Reference<frame::XDispatch>(pDispatch.get());
|
|
else
|
|
return NULL;
|
|
}
|
|
|
|
PresenterProtocolHandler::Dispatch::Dispatch (
|
|
const OUString& rsURLPath,
|
|
const ::rtl::Reference<PresenterController>& rpPresenterController)
|
|
: PresenterDispatchInterfaceBase(m_aMutex),
|
|
msURLPath(rsURLPath),
|
|
mpCommand(CreateCommand(rsURLPath, rpPresenterController)),
|
|
mpPresenterController(rpPresenterController),
|
|
maStatusListenerContainer(),
|
|
mbIsListeningToWindowManager(false)
|
|
{
|
|
if (mpCommand.get() != NULL)
|
|
{
|
|
mpPresenterController->GetWindowManager()->AddLayoutListener(this);
|
|
mbIsListeningToWindowManager = true;
|
|
}
|
|
}
|
|
|
|
Command* PresenterProtocolHandler::Dispatch::CreateCommand (
|
|
const OUString& rsURLPath,
|
|
const ::rtl::Reference<PresenterController>& rpPresenterController)
|
|
{
|
|
if (rsURLPath.getLength() <= 5)
|
|
return NULL;
|
|
|
|
if (rsURLPath == "CloseNotes")
|
|
return new SetNotesViewCommand(false, rpPresenterController);
|
|
if (rsURLPath == "CloseSlideSorter")
|
|
return new SetSlideSorterCommand(false, rpPresenterController);
|
|
if (rsURLPath == "CloseHelp")
|
|
return new SetHelpViewCommand(false, rpPresenterController);
|
|
if (rsURLPath == "GrowNotesFont")
|
|
return new NotesFontSizeCommand(rpPresenterController, +1);
|
|
if (rsURLPath == "NextEffect")
|
|
return new GotoNextEffectCommand(rpPresenterController);
|
|
if (rsURLPath == "NextSlide")
|
|
return new GotoNextSlideCommand(rpPresenterController);
|
|
if (rsURLPath == "PrevSlide")
|
|
return new GotoPreviousSlideCommand(rpPresenterController);
|
|
if (rsURLPath == "SwitchMonitor")
|
|
return new SwitchMonitorCommand(rpPresenterController);
|
|
if (rsURLPath == "ShowNotes")
|
|
return new SetNotesViewCommand(true, rpPresenterController);
|
|
if (rsURLPath == "ShowSlideSorter")
|
|
return new SetSlideSorterCommand(true, rpPresenterController);
|
|
if (rsURLPath == "ShowHelp")
|
|
return new SetHelpViewCommand(true, rpPresenterController);
|
|
if (rsURLPath == "ShrinkNotesFont")
|
|
return new NotesFontSizeCommand(rpPresenterController, -1);
|
|
|
|
return NULL;
|
|
}
|
|
|
|
PresenterProtocolHandler::Dispatch::~Dispatch()
|
|
{
|
|
}
|
|
|
|
void PresenterProtocolHandler::Dispatch::disposing()
|
|
{
|
|
if (mbIsListeningToWindowManager)
|
|
{
|
|
if (mpPresenterController.get() != NULL)
|
|
mpPresenterController->GetWindowManager()->RemoveLayoutListener(this);
|
|
mbIsListeningToWindowManager = false;
|
|
}
|
|
|
|
msURLPath.clear();
|
|
mpCommand.reset();
|
|
}
|
|
|
|
//----- XDispatch -------------------------------------------------------------
|
|
|
|
void SAL_CALL PresenterProtocolHandler::Dispatch::dispatch(
|
|
const css::util::URL& rURL,
|
|
const css::uno::Sequence<css::beans::PropertyValue>& rArguments)
|
|
throw(css::uno::RuntimeException, std::exception)
|
|
{
|
|
(void)rArguments;
|
|
ThrowIfDisposed();
|
|
|
|
if (rURL.Protocol == "vnd.org.libreoffice.presenterscreen:"
|
|
&& rURL.Path == msURLPath)
|
|
{
|
|
if (mpCommand.get() != NULL)
|
|
mpCommand->Execute();
|
|
}
|
|
else
|
|
{
|
|
// We can not throw an IllegalArgumentException
|
|
throw RuntimeException();
|
|
}
|
|
}
|
|
|
|
void SAL_CALL PresenterProtocolHandler::Dispatch::addStatusListener(
|
|
const css::uno::Reference<css::frame::XStatusListener>& rxListener,
|
|
const css::util::URL& rURL)
|
|
throw(css::uno::RuntimeException, std::exception)
|
|
{
|
|
if (rURL.Path == msURLPath)
|
|
{
|
|
maStatusListenerContainer.push_back(rxListener);
|
|
|
|
frame::FeatureStateEvent aEvent;
|
|
aEvent.FeatureURL = rURL;
|
|
aEvent.IsEnabled = mpCommand->IsEnabled();
|
|
aEvent.Requery = sal_False;
|
|
aEvent.State = mpCommand->GetState();
|
|
rxListener->statusChanged(aEvent);
|
|
}
|
|
else
|
|
throw RuntimeException();
|
|
}
|
|
|
|
void SAL_CALL PresenterProtocolHandler::Dispatch::removeStatusListener (
|
|
const css::uno::Reference<css::frame::XStatusListener>& rxListener,
|
|
const css::util::URL& rURL)
|
|
throw(css::uno::RuntimeException, std::exception)
|
|
{
|
|
if (rURL.Path == msURLPath)
|
|
{
|
|
StatusListenerContainer::iterator iListener (
|
|
::std::find(
|
|
maStatusListenerContainer.begin(),
|
|
maStatusListenerContainer.end(),
|
|
rxListener));
|
|
if (iListener != maStatusListenerContainer.end())
|
|
maStatusListenerContainer.erase(iListener);
|
|
}
|
|
else
|
|
throw RuntimeException();
|
|
}
|
|
|
|
void PresenterProtocolHandler::Dispatch::ThrowIfDisposed() const
|
|
throw (::com::sun::star::lang::DisposedException)
|
|
{
|
|
if (rBHelper.bDisposed || rBHelper.bInDispose)
|
|
{
|
|
throw lang::DisposedException (
|
|
OUString(
|
|
"PresenterProtocolHandler::Dispatch object has already been disposed"),
|
|
const_cast<uno::XWeak*>(static_cast<const uno::XWeak*>(this)));
|
|
}
|
|
}
|
|
|
|
//----- document::XEventListener ----------------------------------------------
|
|
|
|
void SAL_CALL PresenterProtocolHandler::Dispatch::notifyEvent (
|
|
const css::document::EventObject& rEvent)
|
|
throw(css::uno::RuntimeException, std::exception)
|
|
{
|
|
(void)rEvent;
|
|
|
|
mpCommand->GetState();
|
|
}
|
|
|
|
//----- lang::XEventListener --------------------------------------------------
|
|
|
|
void SAL_CALL PresenterProtocolHandler::Dispatch::disposing (const css::lang::EventObject& rEvent)
|
|
throw(css::uno::RuntimeException, std::exception)
|
|
{
|
|
(void)rEvent;
|
|
mbIsListeningToWindowManager = false;
|
|
}
|
|
|
|
//===== GotoPreviousSlideCommand ==============================================
|
|
|
|
GotoPreviousSlideCommand::GotoPreviousSlideCommand (
|
|
const rtl::Reference<PresenterController>& rpPresenterController)
|
|
: mpPresenterController(rpPresenterController)
|
|
{
|
|
}
|
|
|
|
void GotoPreviousSlideCommand::Execute()
|
|
{
|
|
if ( ! mpPresenterController.is())
|
|
return;
|
|
|
|
if ( ! mpPresenterController->GetSlideShowController().is())
|
|
return;
|
|
|
|
mpPresenterController->GetSlideShowController()->gotoPreviousSlide();
|
|
}
|
|
|
|
bool GotoPreviousSlideCommand::IsEnabled() const
|
|
{
|
|
if ( ! mpPresenterController.is())
|
|
return false;
|
|
|
|
if ( ! mpPresenterController->GetSlideShowController().is())
|
|
return false;
|
|
|
|
return mpPresenterController->GetSlideShowController()->getCurrentSlideIndex()>0;
|
|
}
|
|
|
|
//===== GotoNextEffect ========================================================
|
|
|
|
GotoNextEffectCommand::GotoNextEffectCommand (
|
|
const rtl::Reference<PresenterController>& rpPresenterController)
|
|
: mpPresenterController(rpPresenterController)
|
|
{
|
|
}
|
|
|
|
void GotoNextEffectCommand::Execute()
|
|
{
|
|
if ( ! mpPresenterController.is())
|
|
return;
|
|
|
|
if ( ! mpPresenterController->GetSlideShowController().is())
|
|
return;
|
|
|
|
mpPresenterController->GetSlideShowController()->gotoNextEffect();
|
|
}
|
|
|
|
//===== GotoNextSlide =========================================================
|
|
|
|
GotoNextSlideCommand::GotoNextSlideCommand (
|
|
const rtl::Reference<PresenterController>& rpPresenterController)
|
|
: mpPresenterController(rpPresenterController)
|
|
{
|
|
}
|
|
|
|
void GotoNextSlideCommand::Execute()
|
|
{
|
|
if ( ! mpPresenterController.is())
|
|
return;
|
|
|
|
if ( ! mpPresenterController->GetSlideShowController().is())
|
|
return;
|
|
|
|
mpPresenterController->GetSlideShowController()->gotoNextSlide();
|
|
}
|
|
|
|
//===== SwitchMonitorCommand ==============================================
|
|
|
|
SwitchMonitorCommand::SwitchMonitorCommand (
|
|
const rtl::Reference<PresenterController>& rpPresenterController)
|
|
: mpPresenterController(rpPresenterController)
|
|
{
|
|
}
|
|
|
|
void SwitchMonitorCommand::Execute()
|
|
{
|
|
mpPresenterController->SwitchMonitors();
|
|
}
|
|
|
|
//===== SetNotesViewCommand ===================================================
|
|
|
|
SetNotesViewCommand::SetNotesViewCommand (
|
|
const bool bOn,
|
|
const rtl::Reference<PresenterController>& rpPresenterController)
|
|
: mbOn(bOn),
|
|
mpPresenterController(rpPresenterController)
|
|
{
|
|
}
|
|
|
|
void SetNotesViewCommand::Execute()
|
|
{
|
|
if ( ! mpPresenterController.is())
|
|
return;
|
|
|
|
::rtl::Reference<PresenterWindowManager> pWindowManager (
|
|
mpPresenterController->GetWindowManager());
|
|
if ( ! pWindowManager.is())
|
|
return;
|
|
|
|
if (mbOn)
|
|
pWindowManager->SetViewMode(PresenterWindowManager::VM_Notes);
|
|
else
|
|
pWindowManager->SetViewMode(PresenterWindowManager::VM_Standard);
|
|
}
|
|
|
|
Any SetNotesViewCommand::GetState() const
|
|
{
|
|
if ( ! mpPresenterController.is())
|
|
return Any(false);
|
|
|
|
::rtl::Reference<PresenterWindowManager> pWindowManager (
|
|
mpPresenterController->GetWindowManager());
|
|
if ( ! pWindowManager.is())
|
|
return Any(false);
|
|
|
|
return Any(IsActive(pWindowManager));
|
|
}
|
|
|
|
bool SetNotesViewCommand::IsActive (
|
|
const ::rtl::Reference<PresenterWindowManager>& rpWindowManager)
|
|
{
|
|
return rpWindowManager->GetViewMode() == PresenterWindowManager::VM_Notes;
|
|
}
|
|
|
|
//===== SetSlideSorterCommand =================================================
|
|
|
|
SetSlideSorterCommand::SetSlideSorterCommand (
|
|
const bool bOn,
|
|
const rtl::Reference<PresenterController>& rpPresenterController)
|
|
: mbOn(bOn),
|
|
mpPresenterController(rpPresenterController)
|
|
{
|
|
}
|
|
|
|
void SetSlideSorterCommand::Execute()
|
|
{
|
|
if ( ! mpPresenterController.is())
|
|
return;
|
|
|
|
::rtl::Reference<PresenterWindowManager> pWindowManager (
|
|
mpPresenterController->GetWindowManager());
|
|
if ( ! pWindowManager.is())
|
|
return;
|
|
|
|
pWindowManager->SetSlideSorterState(mbOn);
|
|
}
|
|
|
|
Any SetSlideSorterCommand::GetState() const
|
|
{
|
|
if ( ! mpPresenterController.is())
|
|
return Any(false);
|
|
|
|
::rtl::Reference<PresenterWindowManager> pWindowManager (
|
|
mpPresenterController->GetWindowManager());
|
|
if ( ! pWindowManager.is())
|
|
return Any(false);
|
|
|
|
return Any(pWindowManager->GetViewMode()==PresenterWindowManager::VM_SlideOverview);
|
|
}
|
|
|
|
//===== SetHelpViewCommand ===================================================
|
|
|
|
SetHelpViewCommand::SetHelpViewCommand (
|
|
const bool bOn,
|
|
const rtl::Reference<PresenterController>& rpPresenterController)
|
|
: mbOn(bOn),
|
|
mpPresenterController(rpPresenterController)
|
|
{
|
|
}
|
|
|
|
void SetHelpViewCommand::Execute()
|
|
{
|
|
if ( ! mpPresenterController.is())
|
|
return;
|
|
|
|
::rtl::Reference<PresenterWindowManager> pWindowManager (
|
|
mpPresenterController->GetWindowManager());
|
|
if ( ! pWindowManager.is())
|
|
return;
|
|
|
|
pWindowManager->SetHelpViewState(mbOn);
|
|
}
|
|
|
|
Any SetHelpViewCommand::GetState() const
|
|
{
|
|
if ( ! mpPresenterController.is())
|
|
return Any(false);
|
|
|
|
::rtl::Reference<PresenterWindowManager> pWindowManager (
|
|
mpPresenterController->GetWindowManager());
|
|
if ( ! pWindowManager.is())
|
|
return Any(false);
|
|
|
|
return Any(pWindowManager->GetViewMode()==PresenterWindowManager::VM_Help);
|
|
}
|
|
|
|
//===== NotesFontSizeCommand ==================================================
|
|
|
|
NotesFontSizeCommand::NotesFontSizeCommand(
|
|
const rtl::Reference<PresenterController>& rpPresenterController,
|
|
const sal_Int32 nSizeChange)
|
|
: mpPresenterController(rpPresenterController),
|
|
mnSizeChange(nSizeChange)
|
|
{
|
|
}
|
|
|
|
::rtl::Reference<PresenterNotesView> NotesFontSizeCommand::GetNotesView() const
|
|
{
|
|
if (mpPresenterController.get() == NULL)
|
|
return NULL;
|
|
|
|
PresenterPaneContainer::SharedPaneDescriptor pDescriptor (
|
|
mpPresenterController->GetPaneContainer()->FindViewURL(
|
|
PresenterViewFactory::msNotesViewURL));
|
|
if (pDescriptor.get() == NULL)
|
|
return NULL;
|
|
|
|
return dynamic_cast<PresenterNotesView*>(pDescriptor->mxView.get());
|
|
}
|
|
|
|
void NotesFontSizeCommand::Execute()
|
|
{
|
|
::rtl::Reference<PresenterNotesView> pView (GetNotesView());
|
|
if (pView.is())
|
|
pView->ChangeFontSize(mnSizeChange);
|
|
}
|
|
|
|
Any NotesFontSizeCommand::GetState() const
|
|
{
|
|
return Any();
|
|
}
|
|
|
|
} } // end of namespace ::sdext::presenter
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|