31 #include <com/sun/star/awt/InvalidateStyle.hpp>
32 #include <com/sun/star/awt/PosSize.hpp>
33 #include <com/sun/star/awt/XWindow2.hpp>
34 #include <com/sun/star/awt/XWindowPeer.hpp>
35 #include <com/sun/star/rendering/CompositeOperation.hpp>
36 #include <com/sun/star/rendering/FillRule.hpp>
37 #include <com/sun/star/rendering/Texture.hpp>
38 #include <com/sun/star/rendering/TexturingMode.hpp>
51 const ::rtl::Reference<PresenterPaneContainer>& rpPaneContainer,
52 const ::rtl::Reference<PresenterController>& rpPresenterController)
58 mxPaneBorderManager(),
59 mpPaneBorderPainter(),
60 mpPaneContainer(rpPaneContainer),
61 mbIsLayoutPending(true),
65 mxScaledBackgroundBitmap(),
67 meLayoutMode(LM_Generic),
68 mbIsSlideSorterActive(false),
69 mbIsHelpViewActive(false),
72 mbIsMouseClickPending(false)
89 xComponent->dispose();
94 if (rxPane->mxBorderWindow.is())
96 rxPane->mxBorderWindow->removeWindowListener(
this);
97 rxPane->mxBorderWindow->removeFocusListener(
this);
98 rxPane->mxBorderWindow->removeMouseListener(
this);
104 const Reference<drawing::framework::XPane>& rxPane)
136 xPeer->setBackground(util::Color(0xff000000));
156 OSL_ASSERT(pDescriptor);
162 pDescriptor->mxContentWindow,
163 sal_Int16(awt::InvalidateStyle::TRANSPARENT
164 | awt::InvalidateStyle::CHILDREN));
169 const OUString& rsPaneURL,
173 const double nHeight)
179 if (pDescriptor->mxBorderWindow.is())
180 pDescriptor->mxBorderWindow->setPosSize(
181 ::sal::static_int_cast<sal_Int32>(nX),
182 ::sal::static_int_cast<sal_Int32>(nY),
183 ::sal::static_int_cast<sal_Int32>(nWidth),
184 ::sal::static_int_cast<sal_Int32>(nHeight),
185 awt::PosSize::POSSIZE);
190 const ::rtl::Reference<PresenterPaneBorderPainter>& rPainter)
206 Reference<awt::XWindow> xWindow (rEvent.Source,UNO_QUERY);
222 Reference<awt::XWindow> xWindow (rEvent.Source,UNO_QUERY);
257 OSL_FAIL(
"paint failed!");
318 if ( ! rxPane->mbIsActive)
320 if (rxPane->mbIsSprite)
322 if ( ! rxPane->mxPane.is())
324 if ( ! rxPane->mxBorderWindow.is())
326 Reference<awt::XWindow> xBorderWindow (rxPane->mxBorderWindow);
327 if ( ! xBorderWindow.is())
331 const awt::Rectangle aBorderBox (xBorderWindow->getPosSize());
332 const awt::Rectangle aBorderUpdateBox(
336 if (aBorderUpdateBox.Width<=0 || aBorderUpdateBox.Height<=0)
339 const awt::Rectangle aLocalBorderUpdateBox(
348 aLocalBorderUpdateBox,
349 sal_Int16(awt::InvalidateStyle::CHILDREN
350 | awt::InvalidateStyle::NOTRANSPARENT));
354 OSL_FAIL(
"paint children failed!");
473 "/org.openoffice.Office.PresenterScreen/",
499 "/org.openoffice.Office.PresenterScreen/",
507 aValue <<= sal_Int32(0);
511 aValue <<= sal_Int32(1);
515 aValue <<= sal_Int32(2);
519 aConfiguration.
SetProperty (
"InitialViewMode", aValue);
528 const Reference<document::XEventListener>& rxListener)
534 const Reference<document::XEventListener>& rxListener)
584 const double nGoldenRatio ((1 + sqrt(5.0)) / 2);
585 const double nGap (20);
586 const double nHorizontalSlideDivide (aBox.Width / nGoldenRatio);
587 double nSlidePreviewTop (0);
598 nHorizontalSlideDivide - 1.5*nGap,
600 nSlidePreviewTop = (aBox.Height - aCurrentSlideOuterBox.Height) / 2;
604 Temp=aBox.Width - aCurrentSlideOuterBox.Width - nGap;
609 aCurrentSlideOuterBox.Width,
610 aCurrentSlideOuterBox.Height);
620 aBox.Width - nHorizontalSlideDivide - 1.5*nGap,
622 double Temp=aBox.Width - aNextSlideOuterBox.Width - nGap;
630 aNextSlideOuterBox.Width,
631 aNextSlideOuterBox.Height);
641 const geometry::RealRectangle2D aToolBarBox (
LayoutToolBar());
643 const double nGoldenRatio ((1 + sqrt(5.0)) / 2);
644 const double nGap (20);
645 const double nPrimaryWidth (aBox.Width / nGoldenRatio);
646 const double nSecondaryWidth (aBox.Width - nPrimaryWidth);
647 const double nTertiaryWidth (nSecondaryWidth / nGoldenRatio);
648 double nSlidePreviewTop (0);
649 double nNotesViewBottom (aToolBarBox.Y1 - nGap);
658 const geometry::RealSize2D aNotesViewOuterSize(
659 nPrimaryWidth - 1.5*nGap + 0.5,
661 nSlidePreviewTop = (aBox.Height
662 - aToolBarBox.Y2 + aToolBarBox.Y1 - aNotesViewOuterSize.Height) / 2;
664 double Temp=aBox.Width - aNotesViewOuterSize.Width - nGap;
671 aNotesViewOuterSize.Width,
672 aNotesViewOuterSize.Height);
673 nNotesViewBottom = nSlidePreviewTop + aNotesViewOuterSize.Height;
683 nSecondaryWidth - 1.5*nGap,
688 Temp=aBox.Width - aCurrentSlideOuterBox.Width - nGap;
693 aCurrentSlideOuterBox.Width,
694 aCurrentSlideOuterBox.Height);
710 Temp=aBox.Width - aNextSlideOuterBox.Width - nGap;
714 nNotesViewBottom - aNextSlideOuterBox.Height,
715 aNextSlideOuterBox.Width,
716 aNextSlideOuterBox.Height);
723 const geometry::RealRectangle2D aToolBarBox (
LayoutToolBar());
726 const double nGap (20);
731 aWindowBox.Width - 2*nGap,
732 aToolBarBox.Y1 - 2*nGap);
737 const geometry::RealRectangle2D aToolBarBox (
LayoutToolBar());
740 const double nGap (20);
741 const double nGoldenRatio ((1 + sqrt(5.0)) / 2);
742 const double nWidth = ::std::min(aWindowBox.Width - 2*nGap, aWindowBox.Width/nGoldenRatio);
745 (aWindowBox.Width - nWidth)/2,
748 aToolBarBox.Y1 - 2*nGap);
753 double nToolBarWidth (400);
754 double nToolBarHeight (80);
776 css::drawing::framework::BorderType_TOTAL_BORDER));
778 nToolBarWidth = aBox.Width;
779 nToolBarHeight = aBox.Height;
783 nToolBarWidth = aSize.Width + 20;
784 nToolBarHeight = aSize.Height + 10;
790 const double nToolBarX ((aBox.Width - nToolBarWidth) / 2);
791 const double nToolBarY (aBox.Height - nToolBarHeight);
799 return geometry::RealRectangle2D(
802 nToolBarX + nToolBarWidth - 1,
803 nToolBarY + nToolBarHeight - 1);
807 const double nOuterWidth,
808 const OUString& rsPaneURL)
814 sal_Int32(nOuterWidth+0.5),sal_Int32(nOuterWidth)),
815 drawing::framework::BorderType_TOTAL_BORDER));
818 const double nCurrentSlideInnerHeight (
825 aInnerBox.Width,sal_Int32(nCurrentSlideInnerHeight+0.5)),
826 drawing::framework::BorderType_TOTAL_BORDER));
828 return awt::Size(aOuterBox.Width, aOuterBox.Height);
833 document::EventObject
aEvent;
834 aEvent.Source = Reference<XInterface>(
static_cast<XWeak*
>(
this));
837 for (
const auto& rxListener : aContainerCopy)
843 rxListener->notifyEvent(aEvent);
845 catch (lang::DisposedException&)
859 aEvent.Source =
static_cast<XWeak*
>(
this);
863 for (
auto& rxListener : aContainer)
869 rxListener->disposing(aEvent);
871 catch (lang::DisposedException&)
900 Reference<rendering::XGraphicDevice> xDevice (
mxParentCanvas->getDevice());
905 Reference<rendering::XPolyPolygon2D> xBackgroundPolygon (
911 const rendering::ViewState aViewState(
912 geometry::AffineMatrix2D(1,0,0, 0,1,0),
914 rendering::RenderState aRenderState (
915 geometry::AffineMatrix2D(1,0,0, 0,1,0),
918 rendering::CompositeOperation::SOURCE);
928 Sequence<rendering::Texture> aTextures (1);
930 aTextures[0] = rendering::Texture (
931 geometry::AffineMatrix2D(
932 aBitmapSize.Width,0,0,
933 0,aBitmapSize.Height,0),
939 rendering::StrokeAttributes(),
940 rendering::TexturingMode::REPEAT,
941 rendering::TexturingMode::REPEAT);
952 aRenderState.DeviceColor[0] = ((aBackgroundColor >> 16) & 0x0ff) / 255.0;
953 aRenderState.DeviceColor[1] = ((aBackgroundColor >> 8) & 0x0ff) / 255.0;
954 aRenderState.DeviceColor[2] = ((aBackgroundColor >> 0) & 0x0ff) / 255.0;
955 aRenderState.DeviceColor[3] = ((aBackgroundColor >> 24) & 0x0ff) / 255.0;
976 if (bStretchHorizontal || bStretchVertical)
978 geometry::RealSize2D aSize;
979 if (bStretchVertical)
982 aSize.Height = xBitmap->getSize().Height;
983 if (bStretchHorizontal)
986 aSize.Width = xBitmap->getSize().Width;
1000 ::std::vector<awt::Rectangle> aRectangles;
1001 aRectangles.reserve(1+nPaneCount);
1005 if ( ! pDescriptor->mbIsActive)
1007 if ( ! pDescriptor->mbIsOpaque)
1009 if ( ! pDescriptor->mxBorderWindow.is() || ! pDescriptor->mxContentWindow.is())
1011 Reference<awt::XWindow2> xWindow (pDescriptor->mxBorderWindow, UNO_QUERY);
1012 if (xWindow.is() && ! xWindow->isVisible())
1015 const awt::Rectangle aOuterBorderBox (pDescriptor->mxBorderWindow->getPosSize());
1016 awt::Rectangle aInnerBorderBox (pDescriptor->mxContentWindow->getPosSize());
1017 aInnerBorderBox.X += aOuterBorderBox.X;
1018 aInnerBorderBox.Y += aOuterBorderBox.Y;
1019 aRectangles.push_back(aInnerBorderBox);
1021 Reference<rendering::XPolyPolygon2D> xPolyPolygon (
1025 if (xPolyPolygon.is())
1026 xPolyPolygon->setFillRule(rendering::FillRule_EVEN_ODD);
1027 return xPolyPolygon;
1040 if (rBHelper.bDisposed || rBHelper.bInDispose)
1042 throw lang::DisposedException (
1043 "PresenterWindowManager has already been disposed",
1044 const_cast<uno::XWeak*>(static_cast<const uno::XWeak*>(
this)));
::rtl::Reference< PresenterController > mpPresenterController
static sal_Int32 Round(const double nValue)
static constexpr OUStringLiteral msCurrentSlidePreviewPaneURL
css::uno::Reference< css::rendering::XCanvas > mxParentCanvas
void ThrowIfDisposed() const
void PaintChildren(const css::awt::PaintEvent &rEvent) const
css::uno::Reference< css::rendering::XBitmap > mxScaledBackgroundBitmap
static constexpr OUStringLiteral msToolBarPaneURL
::std::vector< css::uno::Reference< css::document::XEventListener > > LayoutListenerContainer
virtual void SAL_CALL mouseExited(const css::awt::MouseEvent &rEvent) override
bool mbIsLayouting
This flag is set to while the Layout() method is being executed.
void CommitChanges()
Write any changes that have been made back to the configuration.
void SetLayoutMode(const LayoutMode eMode)
void SetSlideSorterState(bool bIsActive)
void RestoreViewMode()
Restore the layout mode (or slide sorter state) from the configuration.
virtual void SAL_CALL mouseEntered(const css::awt::MouseEvent &rEvent) override
css::uno::Reference< css::uno::XInterface > mxPaneBorderManager
::cppu::WeakComponentImplHelper< css::awt::XWindowListener, css::awt::XPaintListener, css::awt::XMouseListener, css::awt::XFocusListener > PresenterWindowManagerInterfaceBase
virtual void SAL_CALL windowHidden(const css::lang::EventObject &rEvent) override
void SetViewMode(const ViewMode eMode)
The high-level method to switch the view mode.
virtual void SAL_CALL windowResized(const css::awt::WindowEvent &rEvent) override
void ProvideBackgroundBitmap()
This class gives access to the configuration.
std::shared_ptr< PresenterTheme > mpTheme
virtual void SAL_CALL focusGained(const css::awt::FocusEvent &rEvent) override
virtual void SAL_CALL mousePressed(const css::awt::MouseEvent &rEvent) override
bool SetProperty(const OUString &rsPropertyName, const css::uno::Any &rValue)
Modify the property child of the currently focused node.
void SetTheme(const std::shared_ptr< PresenterTheme > &rpTheme)
::rtl::Reference< PresenterPaneBorderPainter > mpPaneBorderPainter
void RemoveLayoutListener(const css::uno::Reference< css::document::XEventListener > &rxListener)
void SetHelpViewState(bool bIsActive)
PresenterWindowManager(const css::uno::Reference< css::uno::XComponentContext > &rxContext, const ::rtl::Reference< PresenterPaneContainer > &rpPaneContainer, const ::rtl::Reference< PresenterController > &rpPresenterController)
static css::awt::Rectangle TranslateRectangle(const css::awt::Rectangle &rBox, const sal_Int32 nXOffset, const sal_Int32 nYOffset)
css::uno::Reference< css::uno::XComponentContext > mxComponentContext
virtual void SAL_CALL windowPaint(const css::awt::PaintEvent &rEvent) override
css::geometry::RealRectangle2D LayoutToolBar()
Layout the tool bar and return its outer bounding box.
void SetParentPane(const css::uno::Reference< css::drawing::framework::XPane > &rxPane)
static constexpr OUStringLiteral msNotesPaneURL
void SetPaneBorderPainter(const ::rtl::Reference< PresenterPaneBorderPainter > &rPainter)
static constexpr OUStringLiteral msNextSlidePreviewPaneURL
void AddLayoutListener(const css::uno::Reference< css::document::XEventListener > &rxListener)
css::uno::Any GetConfigurationNode(const OUString &rsPathToNode)
Return a configuration node below the root of the called object.
static bool GetLayoutRTL()
css::uno::Reference< css::rendering::XPolyPolygon2D > mxClipPolygon
virtual void SAL_CALL windowShown(const css::lang::EventObject &rEvent) override
static css::uno::Reference< css::rendering::XPolyPolygon2D > CreatePolygon(const css::awt::Rectangle &rBox, const css::uno::Reference< css::rendering::XGraphicDevice > &rxDevice)
css::awt::Size CalculatePaneSize(const double nOuterWidth, const OUString &rsPaneURL)
LayoutListenerContainer maLayoutListeners
bool mbIsMouseClickPending
::rtl::Reference< PresenterPaneContainer > mpPaneContainer
void SAL_CALL disposing() override
virtual void SAL_CALL mouseReleased(const css::awt::MouseEvent &rEvent) override
static css::awt::Rectangle Intersection(const css::awt::Rectangle &rBox1, const css::awt::Rectangle &rBox2)
rtl::Reference< PresenterController > mpPresenterController
void StoreViewMode(const ViewMode eViewMode)
void PaintBackground(const css::awt::Rectangle &rUpdateBox)
void SetPanePosSizeAbsolute(const OUString &rsPaneURL, const double nX, const double nY, const double nWidth, const double nHeight)
virtual ~PresenterWindowManager() override
std::shared_ptr< PaneDescriptor > SharedPaneDescriptor
void UpdateWindowSize(const css::uno::Reference< css::awt::XWindow > &rxBorderWindow)
bool mbIsSlideSorterActive
bool GoToChild(const OUString &rsPathToNode)
Move the focused node to the (possibly indirect) child specified by the given path.
virtual void SAL_CALL focusLost(const css::awt::FocusEvent &rEvent) override
ViewMode GetViewMode() const
css::uno::Reference< css::awt::XWindow > mxParentWindow
static constexpr OUStringLiteral msHelpViewURL
static constexpr OUStringLiteral msSlideSorterURL
void LayoutStandardMode()
void NotifyLayoutModeChange()
Notify changes of the layout mode and of the slide sorter state.
virtual void SAL_CALL windowMoved(const css::awt::WindowEvent &rEvent) override
void LayoutSlideSorterMode()
css::uno::Reference< css::rendering::XPolyPolygon2D > CreateClipPolyPolygon() const
css::uno::Reference< css::uno::XComponentContext > mxComponentContext
SharedBitmapDescriptor mpBackgroundBitmap
void SetPauseState(bool bIsPaused)
void NotifyViewCreation(const css::uno::Reference< css::drawing::framework::XView > &rxView)