LibreOffice Module sdext (master) 1
PresenterPane.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include "PresenterPane.hxx"
23#include <com/sun/star/lang/XMultiComponentFactory.hpp>
24
25using namespace ::com::sun::star;
26using namespace ::com::sun::star::uno;
28
29namespace sdext::presenter {
30
31//===== PresenterPane =========================================================
32
34 const Reference<XComponentContext>& rxContext,
35 const ::rtl::Reference<PresenterController>& rpPresenterController)
36 : PresenterPaneBase(rxContext, rpPresenterController)
37{
38 Reference<lang::XMultiComponentFactory> xFactory (
39 mxComponentContext->getServiceManager(), UNO_SET_THROW);
41 xFactory->createInstanceWithContext(
42 "com.sun.star.comp.Draw.PresenterHelper",
44 UNO_QUERY_THROW);
45}
46
48{
49}
50
51//----- XPane -----------------------------------------------------------------
52
53Reference<awt::XWindow> SAL_CALL PresenterPane::getWindow()
54{
56 return mxContentWindow;
57}
58
59Reference<rendering::XCanvas> SAL_CALL PresenterPane::getCanvas()
60{
62 return mxContentCanvas;
63}
64
65//----- XWindowListener -------------------------------------------------------
66
67void SAL_CALL PresenterPane::windowResized (const awt::WindowEvent& rEvent)
68{
70
72
74 ToTop();
75
78}
79
80void SAL_CALL PresenterPane::windowMoved (const awt::WindowEvent& rEvent)
81{
83
85
86 ToTop();
87
90}
91
92void SAL_CALL PresenterPane::windowShown (const lang::EventObject& rEvent)
93{
95
96 ToTop();
97
98 if (mxContentWindow.is())
99 {
101 mxContentWindow->setVisible(true);
102 }
103
106}
107
108void SAL_CALL PresenterPane::windowHidden (const lang::EventObject& rEvent)
109{
111
112 if (mxContentWindow.is())
113 mxContentWindow->setVisible(false);
114}
115
116//----- XPaintListener --------------------------------------------------------
117
118void SAL_CALL PresenterPane::windowPaint (const awt::PaintEvent& rEvent)
119{
121
122 PaintBorder(rEvent.UpdateRect);
123}
124
125
127 const Reference<rendering::XSpriteCanvas>& rxParentCanvas)
128{
129 if ( ! mxPresenterHelper.is())
130 return;
131 if ( ! mxParentWindow.is())
132 return;
133 if ( ! rxParentCanvas.is())
134 return;
135
136 mxBorderCanvas = mxPresenterHelper->createSharedCanvas(
137 rxParentCanvas,
139 rxParentCanvas,
142 mxContentCanvas = mxPresenterHelper->createSharedCanvas(
143 rxParentCanvas,
145 rxParentCanvas,
148
149 PaintBorder(mxBorderWindow->getPosSize());
150}
151
152void PresenterPane::Invalidate (const css::awt::Rectangle& rRepaintBox)
153{
154 // Invalidate the parent window to be able to invalidate an area outside
155 // the current window area.
156 mpPresenterController->GetPaintManager()->Invalidate(mxParentWindow, rRepaintBox);
157}
158
160{
161 if (mxBorderWindow.is() && IsVisible())
162 maBoundingBox = mxBorderWindow->getPosSize();
163 else
164 maBoundingBox = awt::Rectangle();
165}
166
167} // end of namespace ::sdext::presenter
168
169/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Base class of the panes used by the presenter screen.
void PaintBorder(const css::awt::Rectangle &rUpdateRectangle)
virtual void SAL_CALL windowShown(const css::lang::EventObject &rEvent) override
css::uno::Reference< css::awt::XWindow > mxBorderWindow
css::uno::Reference< css::uno::XComponentContext > mxComponentContext
virtual void SAL_CALL windowMoved(const css::awt::WindowEvent &rEvent) override
css::uno::Reference< css::awt::XWindow > mxContentWindow
css::uno::Reference< css::rendering::XCanvas > mxContentCanvas
::rtl::Reference< PresenterController > mpPresenterController
virtual void SAL_CALL windowResized(const css::awt::WindowEvent &rEvent) override
css::uno::Reference< css::awt::XWindow > mxParentWindow
css::uno::Reference< css::rendering::XCanvas > mxBorderCanvas
virtual void SAL_CALL windowHidden(const css::lang::EventObject &rEvent) override
css::uno::Reference< css::drawing::XPresenterHelper > mxPresenterHelper
virtual void SAL_CALL windowShown(const css::lang::EventObject &rEvent) override
virtual void CreateCanvases(const css::uno::Reference< css::rendering::XSpriteCanvas > &rxParentCanvas) override
virtual ~PresenterPane() override
css::uno::Reference< css::awt::XWindow > SAL_CALL getWindow() override
PresenterPane(const css::uno::Reference< css::uno::XComponentContext > &rxContext, const ::rtl::Reference< PresenterController > &rpPresenterController)
virtual void SAL_CALL windowResized(const css::awt::WindowEvent &rEvent) override
virtual void SAL_CALL windowHidden(const css::lang::EventObject &rEvent) override
css::awt::Rectangle maBoundingBox
Store the bounding box so that when the window is resized or moved we still know the old position and...
virtual void SAL_CALL windowPaint(const css::awt::PaintEvent &rEvent) override
css::uno::Reference< css::rendering::XCanvas > SAL_CALL getCanvas() override
void Invalidate(const css::awt::Rectangle &rRepaintBox)
virtual void SAL_CALL windowMoved(const css::awt::WindowEvent &rEvent) override
Reference< XSingleServiceFactory > xFactory