26 #include <com/sun/star/awt/InvalidateStyle.hpp>
27 #include <com/sun/star/awt/PosSize.hpp>
28 #include <com/sun/star/awt/Pointer.hpp>
29 #include <com/sun/star/awt/Toolkit.hpp>
30 #include <com/sun/star/awt/WindowAttribute.hpp>
31 #include <com/sun/star/awt/XWindow.hpp>
32 #include <com/sun/star/awt/XWindowPeer.hpp>
33 #include <com/sun/star/drawing/XPresenterHelper.hpp>
34 #include <com/sun/star/drawing/framework/XControllerManager.hpp>
35 #include <com/sun/star/drawing/framework/XConfigurationController.hpp>
36 #include <com/sun/star/rendering/CompositeOperation.hpp>
37 #include <com/sun/star/rendering/TextDirection.hpp>
38 #include <com/sun/star/rendering/TexturingMode.hpp>
39 #include <osl/mutex.hxx>
50 const css::uno::Reference<css::uno::XComponentContext>& rxContext,
51 const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId,
52 const css::uno::Reference<css::frame::XController>& rxController,
53 const ::rtl::Reference<PresenterController>& rpPresenterController)
58 mxController(rxController),
68 mxBackgroundPolygon1(),
69 mxBackgroundPolygon2(),
71 mnPageAspectRatio(28.0/21.0),
74 mbIsForcedPaintPending(false),
75 mbIsPaintPending(true),
76 msClickToExitPresentationText(),
77 msClickToExitPresentationTitle(),
79 mbIsEndSlideVisible(false),
93 xSlideShowComponent->addEventListener(static_cast<awt::XWindowListener*>(
this));
95 Reference<lang::XMultiComponentFactory>
xFactory (
98 "com.sun.star.comp.Draw.PresenterHelper",
104 Reference<XControllerManager> xCM (
mxController, UNO_QUERY_THROW);
105 Reference<XConfigurationController> xCC (xCM->getConfigurationController());
111 Reference<XPane> xPane (xCC->getResource(
mxViewId->getAnchor()), UNO_QUERY_THROW);
124 Reference<awt::XWindowPeer> xPeer (
mxWindow, UNO_QUERY);
126 xPeer->setBackground(util::Color(0xff000000));
162 "Presenter/Views/CurrentSlidePreview/"
163 "Strings/ClickToExitPresentationText/String")
166 "Presenter/Views/CurrentSlidePreview/"
167 "Strings/ClickToExitPresentationTitle/String")
179 aEvent.Source =
static_cast<XWeak*
>(
this);
183 if (pIterator !=
nullptr)
191 mxWindow->removePaintListener(
this);
192 mxWindow->removeMouseListener(
this);
193 mxWindow->removeMouseMotionListener(
this);
194 mxWindow->removeWindowListener(
this);
201 Reference<XComponent> xComponent (
mxViewCanvas, UNO_QUERY);
204 xComponent->dispose();
211 xComponent->dispose();
215 Reference<XComponent> xComponent (
mxPointer, UNO_QUERY);
218 xComponent->dispose();
225 xComponent->dispose();
232 xComponent->dispose();
250 const css::uno::Reference<css::drawing::XDrawPage>& rxSlide)
259 Reference<awt::XWindowPeer> xPeer (
mxViewWindow, UNO_QUERY);
261 xPeer->invalidate(awt::InvalidateStyle::NOTRANSPARENT);
285 pDescriptor->msTitle.clear();
313 return Reference<rendering::XSpriteCanvas>(
mxViewCanvas, UNO_QUERY);
326 awt::Rectangle aViewWindowBox (
mxViewWindow->getPosSize());
328 awt::Rectangle(0,0, aViewWindowBox.Width,aViewWindowBox.Height),
331 rendering::ViewState aViewState (
332 geometry::AffineMatrix2D(1,0,0, 0,1,0),
334 double const aColor[4] = {0,0,0,0};
335 rendering::RenderState aRenderState(
336 geometry::AffineMatrix2D(1,0,0, 0,1,0),
338 Sequence<double>(aColor,4),
339 rendering::CompositeOperation::SOURCE);
340 mxViewCanvas->fillPolyPolygon(xPolygon, aViewState, aRenderState);
358 const awt::Rectangle aWindowBox =
mxViewWindow->getPosSize();
359 return geometry::AffineMatrix2D(
360 aWindowBox.Width-1, 0, 0,
361 0, aWindowBox.Height-1, 0);
365 return geometry::AffineMatrix2D(1,0,0, 0,1,0);
372 return geometry::IntegerSize2D(0,0);
376 const Reference<util::XModifyListener>& rxListener)
385 const Reference<util::XModifyListener>& rxListener)
394 const Reference<awt::XPaintListener>& rxListener)
403 const Reference<awt::XPaintListener>& rxListener)
412 const Reference<awt::XMouseListener>& rxListener)
421 const Reference<awt::XMouseListener>& rxListener)
430 const Reference<awt::XMouseMotionListener>& rxListener)
439 const Reference<awt::XMouseMotionListener>& rxListener)
459 Reference<awt::XWindowPeer> xPeer (
mxViewWindow, UNO_QUERY);
472 awt::Rectangle aRectangle;
474 aRectangle.X = aRectangle.Y = aRectangle.Width = aRectangle.Height = 0;
497 awt::Rectangle aViewWindowBox (
mxViewWindow->getPosSize());
498 if (aViewWindowBox.Width <= 0 || aViewWindowBox.Height <= 0)
513 awt::MouseEvent
aEvent (rEvent);
514 aEvent.Source =
static_cast<XWeak*
>(
this);
517 if (pIterator !=
nullptr)
519 pIterator->
notifyEach(&awt::XMouseListener::mousePressed, aEvent);
532 awt::MouseEvent
aEvent (rEvent);
533 aEvent.Source =
static_cast<XWeak*
>(
this);
536 if (pIterator !=
nullptr)
538 pIterator->
notifyEach(&awt::XMouseListener::mouseReleased, aEvent);
544 awt::MouseEvent
aEvent (rEvent);
545 aEvent.Source =
static_cast<XWeak*
>(
this);
548 if (pIterator !=
nullptr)
550 pIterator->
notifyEach(&awt::XMouseListener::mouseEntered, aEvent);
556 awt::MouseEvent
aEvent (rEvent);
557 aEvent.Source =
static_cast<XWeak*
>(
this);
560 if (pIterator !=
nullptr)
562 pIterator->
notifyEach(&awt::XMouseListener::mouseExited, aEvent);
570 awt::MouseEvent
aEvent (rEvent);
571 aEvent.Source =
static_cast<XWeak*
>(
this);
574 if (pIterator !=
nullptr)
576 pIterator->
notifyEach(&awt::XMouseMotionListener::mouseDragged, aEvent);
582 awt::MouseEvent
aEvent (rEvent);
583 aEvent.Source =
static_cast<XWeak*
>(
this);
586 if (pIterator !=
nullptr)
588 pIterator->
notifyEach(&awt::XMouseMotionListener::mouseMoved, aEvent);
597 ::osl::MutexGuard aGuard (::osl::Mutex::getGlobalMutex());
656 const rendering::ViewState aViewState(
657 geometry::AffineMatrix2D(1,0,0, 0,1,0),
660 rendering::RenderState aRenderState (
661 geometry::AffineMatrix2D(1,0,0, 0,1,0),
664 rendering::CompositeOperation::SOURCE);
666 Reference<rendering::XBitmap> xBackgroundBitmap (
mpBackground->GetNormalBitmap());
667 if (xBackgroundBitmap.is())
669 Sequence<rendering::Texture> aTextures (1);
670 const geometry::IntegerSize2D aBitmapSize(xBackgroundBitmap->getSize());
671 aTextures[0] = rendering::Texture (
672 geometry::AffineMatrix2D(
673 aBitmapSize.Width,0,0,
674 0,aBitmapSize.Height,0),
680 rendering::StrokeAttributes(),
681 rendering::TexturingMode::REPEAT,
682 rendering::TexturingMode::REPEAT);
713 const rendering::ViewState aViewState(
714 geometry::AffineMatrix2D(1,0,0, 0,1,0),
717 rendering::RenderState aRenderState (
718 geometry::AffineMatrix2D(1,0,0, 0,1,0),
721 rendering::CompositeOperation::SOURCE);
733 if (pTheme ==
nullptr)
736 const OUString sViewStyle (pTheme->GetStyleName(
mxViewId->getResourceURL()));
743 aRenderState.AffineTransform.m02 = 20;
744 aRenderState.AffineTransform.m12 = 40;
745 const rendering::StringContext aContext (
748 const Reference<rendering::XTextLayout> xLayout (
749 pFont->mxFont->createTextLayout(aContext,rendering::TextDirection::WEAK_LEFT_TO_RIGHT,0));
759 Reference<rendering::XSpriteCanvas> xSpriteCanvas (
mxCanvas, UNO_QUERY);
760 if (xSpriteCanvas.is())
761 xSpriteCanvas->updateScreen(
true);
767 awt::PaintEvent
aEvent (rEvent);
768 aEvent.Source =
static_cast<XWeak*
>(
this);
771 if (pIterator !=
nullptr)
773 pIterator->
notifyEach(&awt::XPaintListener::windowPaint, aEvent);
788 Reference<rendering::XSpriteCanvas> xSpriteCanvas (
mxCanvas, UNO_QUERY);
789 if (xSpriteCanvas.is())
790 xSpriteCanvas->updateScreen(
true);
794 const Reference<awt::XWindow>& rxParentWindow)
const
796 Reference<awt::XWindow> xViewWindow;
804 awt::WindowDescriptor aWindowDescriptor (
805 awt::WindowClass_CONTAINER,
807 Reference<awt::XWindowPeer>(rxParentWindow,UNO_QUERY_THROW),
809 awt::Rectangle(0,0,10,10),
810 awt::WindowAttribute::SIZEABLE
811 | awt::WindowAttribute::MOVEABLE
812 | awt::WindowAttribute::NODECORATION);
813 xViewWindow.set( xToolkit->createWindow(aWindowDescriptor),UNO_QUERY_THROW);
816 Reference<awt::XWindowPeer> xPeer (xViewWindow, UNO_QUERY_THROW);
817 xPeer->setBackground(0xff000000);
819 xViewWindow->setVisible(
true);
828 const Reference<awt::XWindow>& rxViewWindow)
const
832 Reference<rendering::XSpriteCanvas>(
mxTopPane->getCanvas(), UNO_QUERY),
844 const awt::Rectangle aWindowBox (
mxWindow->getPosSize());
845 if (aWindowBox.Height > 0)
847 awt::Rectangle aViewWindowBox;
848 const double nWindowAspectRatio (
849 double(aWindowBox.Width) /
double(aWindowBox.Height));
854 aViewWindowBox.Height = aWindowBox.Height;
855 aViewWindowBox.X = (aWindowBox.Width - aViewWindowBox.Width) / 2;
856 aViewWindowBox.Y = 0;
861 aViewWindowBox.Width = aWindowBox.Width;
863 aViewWindowBox.X = 0;
864 aViewWindowBox.Y = (aWindowBox.Height - aViewWindowBox.Height) / 2;
869 aViewWindowBox.Width,
870 aViewWindowBox.Height,
871 awt::PosSize::POSSIZE);
880 lang::EventObject
aEvent (static_cast<XWeak*>(
this));
883 if (pIterator !=
nullptr)
885 pIterator->
notifyEach(&util::XModifyListener::modified, aEvent);
897 const awt::Rectangle aWindowBox (
mxWindow->getPosSize());
898 const awt::Rectangle aViewWindowBox (
mxViewWindow->getPosSize());
899 if (aWindowBox.Height == aViewWindowBox.Height && aWindowBox.Width == aViewWindowBox.Width)
904 else if (aWindowBox.Height == aViewWindowBox.Height)
916 aViewWindowBox.X + aViewWindowBox.Width,
918 aWindowBox.Width - aViewWindowBox.X - aViewWindowBox.Width,
935 aViewWindowBox.Y + aViewWindowBox.Height,
937 aWindowBox.Height - aViewWindowBox.Y - aViewWindowBox.Height),
944 if (rBHelper.bDisposed || rBHelper.bInDispose)
946 throw lang::DisposedException (
947 "PresenterSlideShowView object has already been disposed",
948 static_cast<uno::XWeak*>(
this));
954 Reference<presentation::XSlideShowView> xView (
this);
958 beans::PropertyValue aProperty;
959 aProperty.Name =
"IsSoundEnabled";
960 Sequence<Any> aValues (2);
961 aValues[0] <<= xView;
962 aValues[1] <<=
false;
963 aProperty.Value <<= aValues;
cppu::WeakComponentImplHelper< css::presentation::XSlideShowView, css::awt::XPaintListener, css::awt::XMouseListener, css::awt::XMouseMotionListener, css::awt::XWindowListener, css::drawing::framework::XView, css::drawing::XDrawView > PresenterSlideShowViewInterfaceBase
css::uno::Reference< css::rendering::XCanvas > mxViewCanvas
virtual css::uno::Reference< css::rendering::XSpriteCanvas > SAL_CALL getCanvas() override
Reference< rendering::XCanvas > mxCanvas
css::uno::Reference< css::awt::XWindow > CreateViewWindow(const css::uno::Reference< css::awt::XWindow > &rxParentWindow) const
Create the window into which the slide show will render its content.
std::shared_ptr< FontDescriptor > SharedFontDescriptor
PresenterSlideShowView(const css::uno::Reference< css::uno::XComponentContext > &rxContext, const css::uno::Reference< css::drawing::framework::XResourceId > &rxViewId, const css::uno::Reference< css::frame::XController > &rxController, const ::rtl::Reference< PresenterController > &rpPresenterController)
virtual void SAL_CALL setMouseCursor(::sal_Int16 nPointerShape) override
css::uno::Reference< css::frame::XController > mxController
SharedBitmapDescriptor mpBackground
bool mbIsForcedPaintPending
virtual void SAL_CALL mouseDragged(const css::awt::MouseEvent &rEvent) override
SharedBitmapDescriptor mpBackground
css::uno::Reference< css::drawing::XPresenterHelper > mxPresenterHelper
css::uno::Reference< css::rendering::XCanvas > mxCanvas
static constexpr OUStringLiteral msPresenterScreenRootName
css::uno::Reference< css::rendering::XPolyPolygon2D > mxBackgroundPolygon2
virtual css::geometry::IntegerSize2D SAL_CALL getTranslationOffset() override
virtual void SAL_CALL mouseMoved(const css::awt::MouseEvent &rEvent) override
virtual void SAL_CALL removeTransformationChangedListener(const css::uno::Reference< css::util::XModifyListener > &xListener) override
void SAL_CALL disposeAndClear(const css::lang::EventObject &rEvt)
virtual css::uno::Reference< css::drawing::XDrawPage > SAL_CALL getCurrentPage() override
Reference< drawing::XPresenterHelper > mxPresenterHelper
OInterfaceContainerHelper *SAL_CALL getContainer(const keyType &key) const
This class gives access to the configuration.
virtual void SAL_CALL windowShown(const css::lang::EventObject &rEvent) override
css::uno::Reference< css::drawing::XDrawPage > mxCurrentSlide
void CreateBackgroundPolygons()
virtual css::awt::Rectangle SAL_CALL getCanvasArea() override
virtual void SAL_CALL disposing() override
virtual void SAL_CALL mouseEntered(const css::awt::MouseEvent &rEvent) override
css::uno::Reference< css::drawing::framework::XResourceId > mxViewId
virtual void SAL_CALL addMouseMotionListener(const css::uno::Reference< css::awt::XMouseMotionListener > &xListener) override
css::uno::Reference< css::rendering::XCanvas > CreateViewCanvas(const css::uno::Reference< css::awt::XWindow > &rxWindow) const
void addListener(const keyType &key, const css::uno::Reference< css::uno::XInterface > &r)
virtual void SAL_CALL addMouseListener(const css::uno::Reference< css::awt::XMouseListener > &xListener) override
virtual void SAL_CALL setCurrentPage(const css::uno::Reference< css::drawing::XDrawPage > &rxSlide) override
css::uno::Reference< css::uno::XComponentContext > mxComponentContext
void removeListener(const keyType &key, const css::uno::Reference< css::uno::XInterface > &r)
void PaintEndSlide(const css::awt::Rectangle &rRepaintBox)
virtual void SAL_CALL mousePressed(const css::awt::MouseEvent &rEvent) override
virtual void SAL_CALL windowResized(const css::awt::WindowEvent &rEvent) override
virtual void SAL_CALL clear() override
virtual void SAL_CALL removePaintListener(const css::uno::Reference< css::awt::XPaintListener > &xListener) override
virtual void DeactivatePresenterView() override
Called when the view is put into a cache.
void PaintInnerWindow(const css::awt::PaintEvent &rEvent)
css::uno::Reference< css::presentation::XSlideShowController > GetSlideShowController(const css::uno::Reference< css::frame::XController > &rxController)
Return the slide show controller of a running presentation that has the same document as the given fr...
virtual void SAL_CALL removeMouseMotionListener(const css::uno::Reference< css::awt::XMouseMotionListener > &xListener) override
virtual void SAL_CALL addTransformationChangedListener(const css::uno::Reference< css::util::XModifyListener > &xListener) override
css::uno::Any GetConfigurationNode(const OUString &rsPathToNode)
Return a configuration node below the root of the called object.
virtual void SAL_CALL windowHidden(const css::lang::EventObject &rEvent) override
virtual void SAL_CALL windowPaint(const css::awt::PaintEvent &rEvent) override
virtual void SAL_CALL mouseExited(const css::awt::MouseEvent &rEvent) override
::cppu::OBroadcastHelper maBroadcaster
This broadcast helper is used to notify listeners registered to a SlideShowView object.
virtual void SAL_CALL removeMouseListener(const css::uno::Reference< css::awt::XMouseListener > &xListener) override
virtual void SAL_CALL windowMoved(const css::awt::WindowEvent &rEvent) override
static css::uno::Reference< css::rendering::XPolyPolygon2D > CreatePolygon(const css::awt::Rectangle &rBox, const css::uno::Reference< css::rendering::XGraphicDevice > &rxDevice)
void impl_addAndConfigureView()
virtual void SAL_CALL addPaintListener(const css::uno::Reference< css::awt::XPaintListener > &xListener) override
virtual css::uno::Reference< css::drawing::framework::XResourceId > SAL_CALL getResourceId() override
double mnPageAspectRatio
Aspect ratio of the current slide.
::rtl::Reference< PresenterController > mpPresenterController
css::uno::Reference< css::awt::XPointer > mxPointer
css::uno::Reference< css::presentation::XSlideShowController > mxSlideShowController
virtual sal_Bool SAL_CALL isAnchorOnly() override
rtl::Reference< PresenterController > mpPresenterController
css::uno::Reference< css::drawing::framework::XPane > mxTopPane
virtual void SAL_CALL mouseReleased(const css::awt::MouseEvent &rEvent) override
virtual css::geometry::AffineMatrix2D SAL_CALL getTransformation() override
css::uno::Reference< css::awt::XWindow > mxWindow
static void SetDeviceColor(css::rendering::RenderState &rRenderState, const css::util::Color aColor)
std::shared_ptr< PaneDescriptor > SharedPaneDescriptor
OUString msClickToExitPresentationText
virtual void ReleaseView() override
Called before the view is disposed.
void PaintOuterWindow(const css::awt::Rectangle &rRepaintBox)
Reference< XSingleServiceFactory > xFactory
void notifyEach(void(SAL_CALL ListenerT::*NotificationMethod)(const EventT &), const EventT &Event)
virtual ~PresenterSlideShowView() override
css::uno::Reference< css::uno::XComponentContext > mxComponentContext
OUString msClickToExitPresentationTitle
css::uno::Reference< css::awt::XWindow > mxViewWindow
bool mbIsPresenterViewActive
virtual void ActivatePresenterView() override
css::uno::Reference< css::rendering::XPolyPolygon2D > mxBackgroundPolygon1
css::uno::Reference< css::presentation::XSlideShow > mxSlideShow