LibreOffice Module sdext (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>
30 #include <cppuhelper/basemutex.hxx>
31 #include <cppuhelper/compbase.hxx>
32 #include <rtl/ref.hxx>
33 
34 namespace sdext::presenter {
35 
37 
38 typedef ::cppu::WeakComponentImplHelper <
39  css::awt::XPaintListener,
40  css::awt::XMouseListener
42 
47  : private ::cppu::BaseMutex,
48  public PresenterButtonInterfaceBase
49 {
50 public:
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;
59  PresenterButton(const PresenterButton&) = delete;
60  PresenterButton& operator=(const PresenterButton&) = delete;
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 
87 private:
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  const ::rtl::Reference<PresenterController>& rpPresenterController,
106  const std::shared_ptr<PresenterTheme>& rpTheme,
107  const css::uno::Reference<css::awt::XWindow>& rxParentWindow,
109  const PresenterTheme::SharedFontDescriptor& rMouseOverFont,
110  const OUString& rxText,
111  const OUString& rxAction);
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 (
124  const PresenterBitmapDescriptor::Mode eMode);
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: */
css::uno::Reference< css::rendering::XBitmap > mxNormalBitmap
std::shared_ptr< FontDescriptor > SharedFontDescriptor
const PresenterTheme::SharedFontDescriptor mpFont
css::uno::Reference< css::rendering::XBitmap > mxMouseOverBitmap
PresenterButton(const PresenterButton &)=delete
css::uno::Reference< css::rendering::XCanvas > mxCanvas
::rtl::Reference< PresenterController > mpPresenterController
::cppu::WeakComponentImplHelper< css::awt::XPaintListener, css::awt::XMouseListener > PresenterButtonInterfaceBase
const PresenterTheme::SharedFontDescriptor mpMouseOverFont
PresenterBitmapDescriptor::Mode meState
css::geometry::IntegerSize2D maButtonSize
SharedBitmapDescriptor mpIcon
virtual void SAL_CALL windowPaint(const css::awt::PaintEvent &rEvent) override
Button for the presenter screen.
css::uno::Reference< css::drawing::XPresenterHelper > mxPresenterHelper
std::shared_ptr< PresenterBitmapContainer::BitmapDescriptor > SharedBitmapDescriptor
virtual void SAL_CALL mouseExited(const css::awt::MouseEvent &rEvent) override
void SetCenter(const css::geometry::RealPoint2D &rLocation)
The controller of the presenter screen is responsible for telling the individual views which slides t...
virtual void SAL_CALL disposing() override
static css::uno::Reference< css::rendering::XBitmap > GetBitmap(const SharedBitmapDescriptor &mpIcon, const PresenterBitmapDescriptor::Mode eMode)
css::geometry::IntegerSize2D const & GetSize()
css::geometry::RealPoint2D maCenter
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)
static css::uno::Reference< css::beans::XPropertySet > GetConfigurationProperties(const css::uno::Reference< css::uno::XComponentContext > &rxComponentContext, const OUString &rsConfigurationName)
void SetCanvas(const css::uno::Reference< css::rendering::XCanvas > &rxParentCanvas, const css::uno::Reference< css::awt::XWindow > &rxParentWindow)
virtual void SAL_CALL mousePressed(const css::awt::MouseEvent &rEvent) override
css::geometry::IntegerSize2D CalculateButtonSize()
virtual void SAL_CALL mouseReleased(const css::awt::MouseEvent &rEvent) override
css::uno::Reference< css::awt::XWindow > mxWindow
virtual void SAL_CALL mouseEntered(const css::awt::MouseEvent &rEvent) override
PresenterButton & operator=(const PresenterButton &)=delete
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)
std::shared_ptr< PresenterTheme > mpTheme