20#include <com/sun/star/beans/PropertyAttribute.hpp>
21#include <com/sun/star/drawing/framework/XControllerManager.hpp>
22#include <com/sun/star/frame/XDispatchProvider.hpp>
23#include <com/sun/star/util/URL.hpp>
37#include <sfx2/sfxsids.hrc>
44#include <unomodel.hxx>
64using ::com::sun::star::presentation::XSlideShowController;
65using ::sd::framework::FrameworkHelper;
66using ::com::sun::star::awt::XWindow;
68using namespace ::
cppu;
84 FullScreenWorkWindow (
85 const ::rtl::Reference<SlideShow>& rpSlideShow,
86 ViewShellBase* pViewShellBase)
88 mpRestarter(
std::
make_shared<SlideShowRestarter>(rpSlideShow, pViewShellBase))
91 void Restart(
bool bForce)
93 mpRestarter->Restart(bForce);
98 if (rEvent.
GetType() == DataChangedEventType::DISPLAY)
103 ::std::shared_ptr<SlideShowRestarter> mpRestarter;
130 return aPresentationPropertyMap_Impl;
136, mbIsInStartup(false)
138, mpCurrentViewShellBase( nullptr )
139, mpFullScreenViewShellBase( nullptr )
140, mpFullScreenFrameView( nullptr )
141, mnInPlaceConfigEvent( nullptr )
147 if(
mpDoc ==
nullptr )
148 throw DisposedException();
182 Reference< XSlideShowController > xRet;
183 if( xSlideShow.is() )
184 xRet = xSlideShow->getController();
190 const css::uno::Reference< css::drawing::XDrawPage >& xDrawPage,
191 const css::uno::Reference< css::animations::XAnimationNode >& xAnimationNode )
194 if( !xSlideShow.is() )
197 xSlideShow->startPreview( xDrawPage, xAnimationNode );
204 if( xSlideShow.is() )
211 return xSlideShow.is() && xSlideShow->isRunning();
217 return xSlideShow.is() && xSlideShow->isRunning() && (xSlideShow->mxController->getViewShell() == &rViewShell);
222 SAL_INFO_IF( !
mxController.is(),
"sd.slideshow",
"sd::SlideShow::CreateController(), clean up old controller first!" );
224 Reference< XPresentation2 > xThis(
this );
239 return "com.sun.star.comp.sd.SlideShow";
249 return {
"com.sun.star.presentation.Presentation" };
269 if( pEntry && ((pEntry->
nFlags & PropertyAttribute::READONLY) != 0) )
270 throw PropertyVetoException();
272 bool bValuesChanged =
false;
273 bool bIllegalArgument =
true;
275 switch( pEntry ? pEntry->
nWID : -1 )
277 case ATTR_PRESENT_ALL:
281 if( aValue >>= bVal )
283 bIllegalArgument =
false;
285 if( rPresSettings.
mbAll != bVal )
287 rPresSettings.
mbAll = bVal;
288 bValuesChanged =
true;
295 case ATTR_PRESENT_CHANGE_PAGE:
299 if( aValue >>= bVal )
301 bIllegalArgument =
false;
305 bValuesChanged =
true;
312 case ATTR_PRESENT_ANIMATION_ALLOWED:
316 if( aValue >>= bVal )
318 bIllegalArgument =
false;
322 bValuesChanged =
true;
328 case ATTR_PRESENT_CUSTOMSHOW:
331 if( aValue >>= aShowName )
333 bIllegalArgument =
false;
339 for( pCustomShow = pCustomShowList->
First(); pCustomShow !=
nullptr; pCustomShow = pCustomShowList->
Next() )
341 if( pCustomShow->
GetName() == aShowName )
346 bValuesChanged =
true;
351 case ATTR_PRESENT_ENDLESS:
355 if( aValue >>= bVal )
357 bIllegalArgument =
false;
361 bValuesChanged =
true;
367 case ATTR_PRESENT_FULLSCREEN:
371 if( aValue >>= bVal )
373 bIllegalArgument =
false;
376 bValuesChanged =
true;
382 case ATTR_PRESENT_DIANAME:
385 aValue >>= aPresPage;
386 bIllegalArgument =
false;
389 bValuesChanged =
true;
392 rPresSettings.
mbAll =
false;
396 case ATTR_PRESENT_MANUEL:
400 if( aValue >>= bVal )
402 bIllegalArgument =
false;
406 bValuesChanged =
true;
412 case ATTR_PRESENT_MOUSE:
416 if( aValue >>= bVal )
418 bIllegalArgument =
false;
421 bValuesChanged =
true;
427 case ATTR_PRESENT_ALWAYS_ON_TOP:
431 if( aValue >>= bVal )
433 bIllegalArgument =
false;
437 bValuesChanged =
true;
443 case ATTR_PRESENT_SHOW_NAVIGATION_BUTTONS:
449 bIllegalArgument =
false;
453 bValuesChanged =
true;
459 case ATTR_PRESENT_NAVIGATOR:
460 bIllegalArgument =
false;
463 case ATTR_PRESENT_PEN:
467 if( aValue >>= bVal )
469 bIllegalArgument =
false;
473 bValuesChanged =
true;
479 case ATTR_PRESENT_PAUSE_TIMEOUT:
484 bIllegalArgument =
false;
487 bValuesChanged =
true;
493 case ATTR_PRESENT_SHOW_PAUSELOGO:
497 if( aValue >>= bVal )
499 bIllegalArgument =
false;
503 bValuesChanged =
true;
509 case ATTR_PRESENT_DISPLAY:
511 sal_Int32 nDisplay = 0;
512 if( aValue >>= nDisplay )
514 bIllegalArgument =
false;
519 FullScreenWorkWindow *pWin =
dynamic_cast<FullScreenWorkWindow *
>(
GetWorkWindow());
528 throw UnknownPropertyException( OUString::number(pEntry ? pEntry->
nWID : -1),
static_cast<cppu::OWeakObject*
>(
this));
531 if( bIllegalArgument )
532 throw IllegalArgumentException();
547 switch( pEntry ? pEntry->
nWID : -1 )
549 case ATTR_PRESENT_ALL:
551 case ATTR_PRESENT_CHANGE_PAGE:
553 case ATTR_PRESENT_ANIMATION_ALLOWED:
555 case ATTR_PRESENT_CUSTOMSHOW:
564 return Any( aShowName );
566 case ATTR_PRESENT_ENDLESS:
568 case ATTR_PRESENT_FULLSCREEN:
570 case ATTR_PRESENT_DIANAME:
577 return Any( aSlideName );
579 case ATTR_PRESENT_MANUEL:
581 case ATTR_PRESENT_MOUSE:
583 case ATTR_PRESENT_ALWAYS_ON_TOP:
585 case ATTR_PRESENT_SHOW_NAVIGATION_BUTTONS:
587 case ATTR_PRESENT_NAVIGATOR:
589 case ATTR_PRESENT_PEN:
591 case ATTR_PRESENT_PAUSE_TIMEOUT:
593 case ATTR_PRESENT_SHOW_PAUSELOGO:
595 case ATTR_PRESENT_DISPLAY:
602 throw UnknownPropertyException( OUString::number(pEntry ? pEntry->
nWID : -1),
static_cast<cppu::OWeakObject*
>(
this));
688 if( pFullScreenViewShellBase )
698 ? PresentationFlags::HideAllApps : PresentationFlags::NONE );
703 if( pFullScreenViewShellBase )
710 ::std::shared_ptr<ViewShell> pSharedView (pFullScreenViewShellBase->
GetMainViewShell());
747 pViewShell->Invalidate();
760 Reference<XDrawPage>(
766 if( pViewShell->GetDoc()->IsExitAfterPresenting() )
768 pViewShell->GetDoc()->SetExitAfterPresenting(
false );
770 Reference<frame::XDispatchProvider> xProvider(pViewShell->GetViewShellBase().GetController()->getFrame(),
775 aURL.Complete =
".uno:CloseFrame";
777 uno::Reference< frame::XDispatch >
xDispatch(
778 xProvider->queryDispatch(
779 aURL, OUString(), 0));
783 uno::Sequence< beans::PropertyValue >());
791 && pViewShell->GetDoc()->GetLayerAdmin().GetLayer(
"DrawnInSlideshow"))
794 pViewShell->GetDoc()->GetLayerAdmin().getVisibleLayersODF(aDocLayerIDSet);
795 if (pViewShell->GetFrameView()->GetVisibleLayers() != aDocLayerIDSet)
797 pViewShell->GetFrameView()->SetVisibleLayers(aDocLayerIDSet);
799 pViewShell->GetDoc()->GetLayerAdmin().getPrintableLayersODF(aDocLayerIDSet);
800 if (pViewShell->GetFrameView()->GetPrintableLayers() != aDocLayerIDSet)
802 pViewShell->GetFrameView()->SetPrintableLayers(aDocLayerIDSet);
804 pViewShell->GetDoc()->GetLayerAdmin().getLockedLayersODF(aDocLayerIDSet);
805 if (pViewShell->GetFrameView()->GetLockedLayers() != aDocLayerIDSet)
807 pViewShell->GetFrameView()->SetLockedLayers(aDocLayerIDSet);
809 pViewShell->InvalidateWindows();
815 pViewShell->SwitchActiveViewFireFocus();
876 if(pViewShell && pViewShell->
GetView())
986 ::std::shared_ptr<PresentationViewShell> pShell = std::dynamic_pointer_cast<PresentationViewShell>(rBase.
GetMainViewShell());
987 if (pShell !=
nullptr)
999 pShell->GetActiveWindow()->GrabFocus();
1056 mnInPlaceConfigEvent =
nullptr;
1057 StartInPlacePresentation();
1071 ::std::shared_ptr<ViewShell> pMainViewShell(pHelper->GetViewShell(FrameworkHelper::msCenterPaneURL));
1073 if( pMainViewShell )
1074 eShell = pMainViewShell->GetShellType();
1080 if( pMainViewShell )
1082 FrameView* pFrameView = pMainViewShell->GetFrameView();
1088 pHelper->RequestView( FrameworkHelper::msImpressViewURL, FrameworkHelper::msCenterPaneURL );
1089 pHelper->RunOnConfigurationEvent(
1090 FrameworkHelper::msConfigurationUpdateEndEvent,
1097 if( pParentWindow ==
nullptr )
1100 CreateController( pMainViewShell.get(), pMainViewShell->GetView(), pParentWindow );
1112 bool bSuccess =
false;
1139 OUString Title(
SdResId(STR_FULLSCREEN_SLIDESHOW));
1140 Title = Title.replaceFirst(
"%s",
1142 pWorkWindow->SetText(Title);
1146 if (!pWorkWindow->IsVisible())
1153 FrameView* pOriginalFrameView =
nullptr;
1156 pOriginalFrameView = xShell->GetFrameView();
1180 sal_Int32 nDisplay = 0;
1188 else if( nDisplay == 0)
1193 SAL_INFO(
"sd",
"Presenting on real screen " << nDisplay);
static ImplSVEvent * PostUserEvent(const Link< void *, void > &rLink, void *pCaller=nullptr, bool bReferenceLink=false)
static void RemoveUserEvent(ImplSVEvent *nUserEvent)
static unsigned int GetDisplayExternalScreen()
DataChangedEventType GetType() const
SdCustomShow * GetCurObject()
const OUString & GetName() const
SAL_DLLPRIVATE const css::uno::Reference< css::presentation::XPresentation2 > & getPresentation() const
SAL_DLLPRIVATE const sd::PresentationSettings & getPresentationSettings() const
SdPage * GetSdPage(sal_uInt16 nPgNum, PageKind ePgKind) const
SAL_DLLPRIVATE bool IsExitAfterPresenting() const
SAL_DLLPRIVATE void SetExitAfterPresenting(bool bExitAfterPresenting)
SdCustomShowList * GetCustomShowList(bool bCreate=false)
virtual SAL_DLLPRIVATE void SetChanged(bool bFlag=true) override
SAL_DLLPRIVATE::sd::DrawDocShell * GetDocSh() const
void SetDisplay(sal_Int32 nDisplay)
sal_Int32 GetDisplay() const
css::uno::Reference< css::uno::XInterface > const & getUnoPage()
void InvalidateAll(bool bWithMsg)
void SetPresentationMode(bool bSet)
static SfxFrame * CreateHidden(SfxObjectShell const &rDoc, vcl::Window &rWindow, SfxInterfaceId nViewId)
vcl::Window & GetWindow() const
SAL_WARN_UNUSED_RESULT SfxViewFrame * GetCurrentViewFrame() const
OUString GetTitle(sal_uInt16 nMaxLen=0) const
SfxViewShell * GetViewShell() const
static SAL_WARN_UNUSED_RESULT SfxViewFrame * Current()
SfxBindings & GetBindings()
static SAL_WARN_UNUSED_RESULT SfxViewFrame * GetFirst(const SfxObjectShell *pDoc=nullptr, bool bOnlyVisible=true)
SfxFrame & GetFrame() const
vcl::Window * GetWindow() const
css::uno::Reference< css::beans::XPropertySetInfo > const & getPropertySetInfo() const
const SfxItemPropertyMapEntry * getPropertyMapEntry(std::u16string_view rName) const
static VclPtr< reference_type > Create(Arg &&... arg)
void StartPresentationMode(bool bPresentation, PresentationFlags nFlags, sal_Int32 nDisplayScreen)
css::uno::Type const & get()
The DrawController is the UNO controller for Impress and Draw.
virtual void SAL_CALL setCurrentPage(const css::uno::Reference< css::drawing::XDrawPage > &xPage) override
Base class of the stacked shells that provide graphical views to Draw and Impress documents and editi...
bool SwitchPage(sal_uInt16 nPage, bool bAllowChangeFocus=true)
Switch to desired page.
sal_uInt16 GetPresentationViewShellId() const
ViewShell::ShellType GetPreviousViewShellType() const
Return the type of the view shell previously associated with this frame view.
void SetPresentationViewShellId(sal_uInt16 nId)
void SetPreviousViewShellType(ViewShell::ShellType eType)
Remember the type of the view shell that was (or soon will be) previously associated with this frame ...
void SetPageKind(PageKind eKind)
This view shell is responsible for showing the presentation of an Impress document.
virtual void disposing(std::unique_lock< std::mutex > &) override
void SetExitAfterPresenting(bool bExit)
static rtl::Reference< SlideShow > Create(SdDrawDocument *pDoc)
used by the model to create a slideshow for it
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
bool mbIsInStartup
This flag is used together with mxController.is() to prevent multiple instances of the slide show for...
void jumpToBookmark(const OUString &sBookmark)
ImplSVEvent * mnInPlaceConfigEvent
virtual sal_Bool SAL_CALL isRunning() override
bool isFullScreen() const
virtual void SAL_CALL start() override
static bool IsRunning(ViewShellBase const &rBase)
returns true if there is a running presentation for the given ViewShellBase
bool swipe(const CommandGestureSwipeData &rSwipeData)
rtl::Reference< SlideshowImpl > mxController
virtual void SAL_CALL end() override
ViewShellBase * mpCurrentViewShellBase
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual void SAL_CALL addPropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
static css::uno::Reference< css::presentation::XSlideShowController > GetSlideShowController(ViewShellBase const &rBase)
std::shared_ptr< PresentationSettingsEx > mxCurrentSettings
void jumpToPageIndex(sal_Int32 nIndex)
bool dependsOn(ViewShellBase const *pViewShellBase)
virtual void SAL_CALL rehearseTimings() override
virtual void SAL_CALL removeVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
SvxItemPropertySet maPropSet
sal_Int32 getCurrentPageNumber() const
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
void ThrowIfDisposed() const
virtual OUString SAL_CALL getImplementationName() override
WorkWindow * GetWorkWindow()
void StartInPlacePresentationConfigurationCallback()
void startPreview(const css::uno::Reference< css::drawing::XDrawPage > &xDrawPage, const css::uno::Reference< css::animations::XAnimationNode > &xAnimationNode)
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
int getAnimationMode() const
void StartInPlacePresentation()
SlideShow(SdDrawDocument *pDoc)
static sal_Int32 GetDisplay()
convert configuration setting display concept to real screens
void resize(const Size &rSize)
void StartFullscreenPresentation()
virtual void SAL_CALL addVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
static void Stop(ViewShellBase const &rBase)
OutputDevice * getShowWindow()
virtual void SAL_CALL removePropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) override
bool activate(ViewShellBase &rBase)
virtual css::uno::Reference< css::presentation::XSlideShowController > SAL_CALL getController() override
void jumpToPageNumber(sal_Int32 nPage)
static bool StartPreview(ViewShellBase const &rBase, const css::uno::Reference< css::drawing::XDrawPage > &xDrawPage, const css::uno::Reference< css::animations::XAnimationNode > &xAnimationNode)
static rtl::Reference< SlideShow > GetSlideShow(SdDrawDocument const *pDocument)
void pause(bool bPause)
sets or clears the pause state of the running slideshow.
virtual void SAL_CALL startWithArguments(const css::uno::Sequence< css::beans::PropertyValue > &Arguments) override
bool IsExitAfterPresenting() const
bool longpress(const CommandGestureLongPressData &rLongPressData)
bool keyInput(const KeyEvent &rKEvt)
ViewShellBase * mpFullScreenViewShellBase
FrameView * mpFullScreenFrameView
void CreateController(ViewShell *pViewSh, ::sd::View *pView, vcl::Window *pParentWindow)
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
SfxViewShell descendant that the stacked Draw/Impress shells are based on.
DrawController * GetDrawController() const
static ViewShellBase * GetViewShellBase(SfxViewFrame const *pFrame)
When given a view frame this static method returns the corresponding sd::ViewShellBase object.
std::shared_ptr< ViewShell > GetMainViewShell() const
Return the main view shell stacked on the called ViewShellBase object.
vcl::Window * GetViewWindow()
Return the window that is used by the main view shell to display its view and other UI elements,...
DrawDocShell * GetDocShell() const
SdDrawDocument * GetDocument() const
Base class of the stacked shell hierarchy.
FrameView * GetFrameView()
::sd::View * GetView() const
SD_DLLPUBLIC ViewShellBase & GetViewShellBase() const
SD_DLLPUBLIC SfxViewFrame * GetViewFrame() const
SD_DLLPUBLIC ShellType GetShellType() const
Return the type of the shell.
virtual SdrEndTextEditKind SdrEndTextEdit(bool bDontDeleteReally=false) override
ends current text editing
static OUString GetViewURL(ViewShell::ShellType eType)
Return a view URL for the given identifier.
static const OUString msCenterPaneURL
static ::std::shared_ptr< FrameworkHelper > Instance(ViewShellBase &rBase)
Return the FrameworkHelper object that is associated with the given ViewShellBase.
vcl::Window * GetParent() const
virtual void DataChanged(const DataChangedEvent &rDCEvt)
constexpr ::Color COL_BLACK(0x00, 0x00, 0x00)
Reference< XDispatch > xDispatch
Sequence< PropertyValue > aArguments
#define LINK(Instance, Class, Member)
#define SAL_INFO_IF(condition, area, stream)
#define SAL_INFO(area, stream)
css::beans::PropertyValue makePropertyValue(const OUString &rName, T &&rValue)
bool any2bool(const css::uno::Any &rAny)
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
std::shared_ptr< T > make_shared(Args &&... args)
IMPL_LINK_NOARG(MainSequence, onTimerHdl, Timer *, void)
constexpr auto PRESENTATION_FACTORY_ID
OUString SdResId(TranslateId aId)
static o3tl::span< const SfxItemPropertyMapEntry > ImplGetPresentationPropertyMap()
Reference< presentation::XPresentation2 > CreatePresentation(const SdDrawDocument &rDocument)
Reference< XController > xController
OUString getPageApiNameFromUiName(const OUString &rUIName)
OUString getUiNameFromPageApiNameImpl(const OUString &rApiName)
WinBits const WB_CLIPCHILDREN