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),
61 mnPageAspectRatio(28.0/21.0),
63 mbIsForcedPaintPending(
false),
64 mbIsPaintPending(true),
65 mbIsEndSlideVisible(
false)
78 xSlideShowComponent->addEventListener(static_cast<awt::XWindowListener*>(
this));
80 Reference<lang::XMultiComponentFactory>
xFactory (
83 "com.sun.star.comp.Draw.PresenterHelper",
89 Reference<XControllerManager> xCM (
mxController, UNO_QUERY_THROW);
90 Reference<XConfigurationController> xCC (xCM->getConfigurationController());
96 Reference<XPane> xPane (xCC->getResource(
mxViewId->getAnchor()), UNO_QUERY_THROW);
109 Reference<awt::XWindowPeer> xPeer (
mxWindow, UNO_QUERY);
111 xPeer->setBackground(util::Color(0xff000000));
147 "Presenter/Views/CurrentSlidePreview/"
148 "Strings/ClickToExitPresentationText/String")
151 "Presenter/Views/CurrentSlidePreview/"
152 "Strings/ClickToExitPresentationTitle/String")
164 aEvent.Source =
static_cast<XWeak*
>(
this);
168 if (pIterator !=
nullptr)
176 mxWindow->removePaintListener(
this);
177 mxWindow->removeMouseListener(
this);
178 mxWindow->removeMouseMotionListener(
this);
179 mxWindow->removeWindowListener(
this);
186 Reference<XComponent> xComponent (
mxViewCanvas, UNO_QUERY);
189 xComponent->dispose();
196 xComponent->dispose();
200 Reference<XComponent> xComponent (
mxPointer, UNO_QUERY);
203 xComponent->dispose();
210 xComponent->dispose();
217 xComponent->dispose();
235 const css::uno::Reference<css::drawing::XDrawPage>& rxSlide)
244 Reference<awt::XWindowPeer> xPeer (
mxViewWindow, UNO_QUERY);
246 xPeer->invalidate(awt::InvalidateStyle::NOTRANSPARENT);
270 pDescriptor->msTitle.clear();
298 return Reference<rendering::XSpriteCanvas>(
mxViewCanvas, UNO_QUERY);
311 awt::Rectangle aViewWindowBox (
mxViewWindow->getPosSize());
313 awt::Rectangle(0,0, aViewWindowBox.Width,aViewWindowBox.Height),
316 rendering::ViewState aViewState (
317 geometry::AffineMatrix2D(1,0,0, 0,1,0),
319 double const aColor[4] = {0,0,0,0};
320 rendering::RenderState aRenderState(
321 geometry::AffineMatrix2D(1,0,0, 0,1,0),
323 Sequence<double>(aColor,4),
324 rendering::CompositeOperation::SOURCE);
325 mxViewCanvas->fillPolyPolygon(xPolygon, aViewState, aRenderState);
343 const awt::Rectangle aWindowBox =
mxViewWindow->getPosSize();
344 return geometry::AffineMatrix2D(
345 aWindowBox.Width-1, 0, 0,
346 0, aWindowBox.Height-1, 0);
350 return geometry::AffineMatrix2D(1,0,0, 0,1,0);
357 return geometry::IntegerSize2D(0,0);
361 const Reference<util::XModifyListener>& rxListener)
370 const Reference<util::XModifyListener>& rxListener)
379 const Reference<awt::XPaintListener>& rxListener)
388 const Reference<awt::XPaintListener>& rxListener)
397 const Reference<awt::XMouseListener>& rxListener)
406 const Reference<awt::XMouseListener>& rxListener)
415 const Reference<awt::XMouseMotionListener>& rxListener)
424 const Reference<awt::XMouseMotionListener>& rxListener)
444 Reference<awt::XWindowPeer> xPeer (
mxViewWindow, UNO_QUERY);
457 awt::Rectangle aRectangle;
459 aRectangle.X = aRectangle.Y = aRectangle.Width = aRectangle.Height = 0;
482 awt::Rectangle aViewWindowBox (
mxViewWindow->getPosSize());
483 if (aViewWindowBox.Width <= 0 || aViewWindowBox.Height <= 0)
498 awt::MouseEvent
aEvent (rEvent);
499 aEvent.Source =
static_cast<XWeak*
>(
this);
502 if (pIterator !=
nullptr)
504 pIterator->
notifyEach(&awt::XMouseListener::mousePressed, aEvent);
517 awt::MouseEvent
aEvent (rEvent);
518 aEvent.Source =
static_cast<XWeak*
>(
this);
521 if (pIterator !=
nullptr)
523 pIterator->
notifyEach(&awt::XMouseListener::mouseReleased, aEvent);
529 awt::MouseEvent
aEvent (rEvent);
530 aEvent.Source =
static_cast<XWeak*
>(
this);
533 if (pIterator !=
nullptr)
535 pIterator->
notifyEach(&awt::XMouseListener::mouseEntered, aEvent);
541 awt::MouseEvent
aEvent (rEvent);
542 aEvent.Source =
static_cast<XWeak*
>(
this);
545 if (pIterator !=
nullptr)
547 pIterator->
notifyEach(&awt::XMouseListener::mouseExited, aEvent);
555 awt::MouseEvent
aEvent (rEvent);
556 aEvent.Source =
static_cast<XWeak*
>(
this);
559 if (pIterator !=
nullptr)
561 pIterator->
notifyEach(&awt::XMouseMotionListener::mouseDragged, aEvent);
567 awt::MouseEvent
aEvent (rEvent);
568 aEvent.Source =
static_cast<XWeak*
>(
this);
571 if (pIterator !=
nullptr)
573 pIterator->
notifyEach(&awt::XMouseMotionListener::mouseMoved, aEvent);
582 ::osl::MutexGuard aGuard (::osl::Mutex::getGlobalMutex());
641 const rendering::ViewState aViewState(
642 geometry::AffineMatrix2D(1,0,0, 0,1,0),
645 rendering::RenderState aRenderState (
646 geometry::AffineMatrix2D(1,0,0, 0,1,0),
649 rendering::CompositeOperation::SOURCE);
651 Reference<rendering::XBitmap> xBackgroundBitmap (
mpBackground->GetNormalBitmap());
652 if (xBackgroundBitmap.is())
654 const geometry::IntegerSize2D aBitmapSize(xBackgroundBitmap->getSize());
655 Sequence<rendering::Texture> aTextures
658 geometry::AffineMatrix2D( aBitmapSize.Width,0,0, 0,aBitmapSize.Height,0),
664 rendering::StrokeAttributes(),
665 rendering::TexturingMode::REPEAT,
666 rendering::TexturingMode::REPEAT
699 const rendering::ViewState aViewState(
700 geometry::AffineMatrix2D(1,0,0, 0,1,0),
703 rendering::RenderState aRenderState (
704 geometry::AffineMatrix2D(1,0,0, 0,1,0),
707 rendering::CompositeOperation::SOURCE);
719 if (pTheme ==
nullptr)
722 const OUString sViewStyle (pTheme->GetStyleName(
mxViewId->getResourceURL()));
729 aRenderState.AffineTransform.m02 = 20;
730 aRenderState.AffineTransform.m12 = 40;
731 const rendering::StringContext aContext (
734 const Reference<rendering::XTextLayout> xLayout (
735 pFont->mxFont->createTextLayout(aContext,rendering::TextDirection::WEAK_LEFT_TO_RIGHT,0));
745 Reference<rendering::XSpriteCanvas> xSpriteCanvas (
mxCanvas, UNO_QUERY);
746 if (xSpriteCanvas.is())
747 xSpriteCanvas->updateScreen(
true);
753 awt::PaintEvent
aEvent (rEvent);
754 aEvent.Source =
static_cast<XWeak*
>(
this);
757 if (pIterator !=
nullptr)
759 pIterator->
notifyEach(&awt::XPaintListener::windowPaint, aEvent);
774 Reference<rendering::XSpriteCanvas> xSpriteCanvas (
mxCanvas, UNO_QUERY);
775 if (xSpriteCanvas.is())
776 xSpriteCanvas->updateScreen(
true);
780 const Reference<awt::XWindow>& rxParentWindow)
const
782 Reference<awt::XWindow> xViewWindow;
790 awt::WindowDescriptor aWindowDescriptor (
791 awt::WindowClass_CONTAINER,
793 Reference<awt::XWindowPeer>(rxParentWindow,UNO_QUERY_THROW),
795 awt::Rectangle(0,0,10,10),
796 awt::WindowAttribute::SIZEABLE
797 | awt::WindowAttribute::MOVEABLE
798 | awt::WindowAttribute::NODECORATION);
799 xViewWindow.set( xToolkit->createWindow(aWindowDescriptor),UNO_QUERY_THROW);
802 Reference<awt::XWindowPeer> xPeer (xViewWindow, UNO_QUERY_THROW);
803 xPeer->setBackground(0xff000000);
805 xViewWindow->setVisible(
true);
814 const Reference<awt::XWindow>& rxViewWindow)
const
818 Reference<rendering::XSpriteCanvas>(
mxTopPane->getCanvas(), UNO_QUERY),
830 const awt::Rectangle aWindowBox (
mxWindow->getPosSize());
831 if (aWindowBox.Height > 0)
833 awt::Rectangle aViewWindowBox;
834 const double nWindowAspectRatio (
835 double(aWindowBox.Width) /
double(aWindowBox.Height));
840 aViewWindowBox.Height = aWindowBox.Height;
841 aViewWindowBox.X = (aWindowBox.Width - aViewWindowBox.Width) / 2;
842 aViewWindowBox.Y = 0;
847 aViewWindowBox.Width = aWindowBox.Width;
849 aViewWindowBox.X = 0;
850 aViewWindowBox.Y = (aWindowBox.Height - aViewWindowBox.Height) / 2;
855 aViewWindowBox.Width,
856 aViewWindowBox.Height,
857 awt::PosSize::POSSIZE);
866 lang::EventObject
aEvent (static_cast<XWeak*>(
this));
869 if (pIterator !=
nullptr)
871 pIterator->
notifyEach(&util::XModifyListener::modified, aEvent);
883 const awt::Rectangle aWindowBox (
mxWindow->getPosSize());
884 const awt::Rectangle aViewWindowBox (
mxViewWindow->getPosSize());
885 if (aWindowBox.Height == aViewWindowBox.Height && aWindowBox.Width == aViewWindowBox.Width)
890 else if (aWindowBox.Height == aViewWindowBox.Height)
902 aViewWindowBox.X + aViewWindowBox.Width,
904 aWindowBox.Width - aViewWindowBox.X - aViewWindowBox.Width,
921 aViewWindowBox.Y + aViewWindowBox.Height,
923 aWindowBox.Height - aViewWindowBox.Y - aViewWindowBox.Height),
930 if (rBHelper.bDisposed || rBHelper.bInDispose)
932 throw lang::DisposedException (
933 "PresenterSlideShowView object has already been disposed",
934 static_cast<uno::XWeak*>(
this));
940 Reference<presentation::XSlideShowView> xView (
this);
944 beans::PropertyValue aProperty;
945 aProperty.Name =
"IsSoundEnabled";
946 Sequence<Any> aValues{
Any(xView),
Any(
false) };
947 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
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
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
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
bool m_bDetectedRangeSegmentation false