LibreOffice Module sd (master) 1
PresenterButton.hxx
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#ifndef INCLUDED_SDEXT_SOURCE_PRESENTER_PRESENTERBUTTON_HXX
21#define INCLUDED_SDEXT_SOURCE_PRESENTER_PRESENTERBUTTON_HXX
22
24#include "PresenterTheme.hxx"
25#include <com/sun/star/awt/XWindow.hpp>
26#include <com/sun/star/awt/XPaintListener.hpp>
27#include <com/sun/star/awt/XMouseListener.hpp>
28#include <com/sun/star/rendering/XCanvas.hpp>
29#include <com/sun/star/rendering/XBitmap.hpp>
32#include <rtl/ref.hxx>
33
34namespace sdext::presenter {
35
36class PresenterController;
37
38typedef ::cppu::WeakComponentImplHelper <
39 css::awt::XPaintListener,
40 css::awt::XMouseListener
42
47 : private ::cppu::BaseMutex,
49{
50public:
51 static ::rtl::Reference<PresenterButton> Create (
52 const css::uno::Reference<css::uno::XComponentContext>& rxComponentContext,
53 const ::rtl::Reference<PresenterController>& rpPresenterController,
54 const std::shared_ptr<PresenterTheme>& rpTheme,
55 const css::uno::Reference<css::awt::XWindow>& rxParentWindow,
56 const css::uno::Reference<css::rendering::XCanvas>& rxParentCanvas,
57 const OUString& rsConfigurationName);
58 virtual ~PresenterButton() override;
61
62 virtual void SAL_CALL disposing() override;
63
64 void SetCenter (const css::geometry::RealPoint2D& rLocation);
65 void SetCanvas (
66 const css::uno::Reference<css::rendering::XCanvas>& rxParentCanvas,
67 const css::uno::Reference<css::awt::XWindow>& rxParentWindow);
68 css::geometry::IntegerSize2D const & GetSize();
69
70 // XPaintListener
71
72 virtual void SAL_CALL windowPaint (const css::awt::PaintEvent& rEvent) override;
73
74 // XMouseListener
75
76 virtual void SAL_CALL mousePressed (const css::awt::MouseEvent& rEvent) override;
77
78 virtual void SAL_CALL mouseReleased (const css::awt::MouseEvent& rEvent) override;
79
80 virtual void SAL_CALL mouseEntered (const css::awt::MouseEvent& rEvent) override;
81
82 virtual void SAL_CALL mouseExited (const css::awt::MouseEvent& rEvent) override;
83
84 // lang::XEventListener
85 virtual void SAL_CALL disposing (const css::lang::EventObject& rEvent) override;
86
87private:
89 std::shared_ptr<PresenterTheme> mpTheme;
90 css::uno::Reference<css::awt::XWindow> mxWindow;
91 css::uno::Reference<css::rendering::XCanvas> mxCanvas;
92 css::uno::Reference<css::drawing::XPresenterHelper> mxPresenterHelper;
93 const OUString msText;
96 const OUString msAction;
97 css::geometry::RealPoint2D maCenter;
98 css::geometry::IntegerSize2D maButtonSize;
100 css::uno::Reference<css::rendering::XBitmap> mxNormalBitmap;
101 css::uno::Reference<css::rendering::XBitmap> mxMouseOverBitmap;
102
104 const css::uno::Reference<css::uno::XComponentContext>& rxComponentContext,
105 ::rtl::Reference<PresenterController> xPresenterController,
106 std::shared_ptr<PresenterTheme> xTheme,
107 const css::uno::Reference<css::awt::XWindow>& rxParentWindow,
110 OUString sText,
111 OUString sAction);
112 void RenderButton (
113 const css::uno::Reference<css::rendering::XCanvas>& rxCanvas,
114 const css::geometry::IntegerSize2D& rSize,
117 const SharedBitmapDescriptor& rpLeft,
118 const SharedBitmapDescriptor& rpCenter,
119 const SharedBitmapDescriptor& rpRight);
120 css::geometry::IntegerSize2D CalculateButtonSize();
121 void Invalidate();
122 static css::uno::Reference<css::rendering::XBitmap> GetBitmap (
125 void SetupButtonBitmaps();
126 static css::uno::Reference<css::beans::XPropertySet> GetConfigurationProperties (
127 const css::uno::Reference<css::uno::XComponentContext>& rxComponentContext,
128 const OUString& rsConfigurationName);
129
131 void ThrowIfDisposed() const;
132};
133
134}
135
136#endif
137
138/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SharedBitmapDescriptor mpIcon
Button for the presenter screen.
css::uno::Reference< css::rendering::XCanvas > mxCanvas
PresenterButton(const PresenterButton &)=delete
virtual void SAL_CALL mousePressed(const css::awt::MouseEvent &rEvent) override
virtual void SAL_CALL disposing() override
static css::uno::Reference< css::rendering::XBitmap > GetBitmap(const SharedBitmapDescriptor &mpIcon, const PresenterBitmapDescriptor::Mode eMode)
static ::rtl::Reference< PresenterButton > Create(const css::uno::Reference< css::uno::XComponentContext > &rxComponentContext, const ::rtl::Reference< PresenterController > &rpPresenterController, const std::shared_ptr< PresenterTheme > &rpTheme, const css::uno::Reference< css::awt::XWindow > &rxParentWindow, const css::uno::Reference< css::rendering::XCanvas > &rxParentCanvas, const OUString &rsConfigurationName)
css::uno::Reference< css::awt::XWindow > mxWindow
css::uno::Reference< css::rendering::XBitmap > mxMouseOverBitmap
PresenterButton & operator=(const PresenterButton &)=delete
css::geometry::RealPoint2D maCenter
::rtl::Reference< PresenterController > mpPresenterController
const PresenterTheme::SharedFontDescriptor mpFont
static css::uno::Reference< css::beans::XPropertySet > GetConfigurationProperties(const css::uno::Reference< css::uno::XComponentContext > &rxComponentContext, const OUString &rsConfigurationName)
css::uno::Reference< css::drawing::XPresenterHelper > mxPresenterHelper
void RenderButton(const css::uno::Reference< css::rendering::XCanvas > &rxCanvas, const css::geometry::IntegerSize2D &rSize, const PresenterTheme::SharedFontDescriptor &rFont, const PresenterBitmapDescriptor::Mode eMode, const SharedBitmapDescriptor &rpLeft, const SharedBitmapDescriptor &rpCenter, const SharedBitmapDescriptor &rpRight)
css::uno::Reference< css::rendering::XBitmap > mxNormalBitmap
void SetCenter(const css::geometry::RealPoint2D &rLocation)
virtual void SAL_CALL mouseEntered(const css::awt::MouseEvent &rEvent) override
std::shared_ptr< PresenterTheme > mpTheme
void SetCanvas(const css::uno::Reference< css::rendering::XCanvas > &rxParentCanvas, const css::uno::Reference< css::awt::XWindow > &rxParentWindow)
css::geometry::IntegerSize2D const & GetSize()
virtual void SAL_CALL mouseExited(const css::awt::MouseEvent &rEvent) override
virtual void SAL_CALL mouseReleased(const css::awt::MouseEvent &rEvent) override
virtual void SAL_CALL windowPaint(const css::awt::PaintEvent &rEvent) override
css::geometry::IntegerSize2D CalculateButtonSize()
PresenterBitmapDescriptor::Mode meState
const PresenterTheme::SharedFontDescriptor mpMouseOverFont
css::geometry::IntegerSize2D maButtonSize
std::shared_ptr< FontDescriptor > SharedFontDescriptor
::cppu::WeakComponentImplHelper< css::awt::XPaintListener, css::awt::XMouseListener > PresenterButtonInterfaceBase
std::shared_ptr< PresenterBitmapContainer::BitmapDescriptor > SharedBitmapDescriptor