tdf#161411 - UI: Add Better wording for ASCII-only characters
[LibreOffice.git] / sd / source / console / PresenterButton.hxx
blobec2f617bd64a5255eb2dd1b4c40142c926d3d9a0
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SDEXT_SOURCE_PRESENTER_PRESENTERBUTTON_HXX
21 #define INCLUDED_SDEXT_SOURCE_PRESENTER_PRESENTERBUTTON_HXX
23 #include "PresenterBitmapContainer.hxx"
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>
34 namespace sdext::presenter {
36 class PresenterController;
38 typedef ::cppu::WeakComponentImplHelper <
39 css::awt::XPaintListener,
40 css::awt::XMouseListener
41 > PresenterButtonInterfaceBase;
43 /** Button for the presenter screen. It displays a text surrounded by a
44 frame.
46 class PresenterButton
47 : private ::cppu::BaseMutex,
48 public PresenterButtonInterfaceBase
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;
62 virtual void SAL_CALL disposing() override;
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();
70 // XPaintListener
72 virtual void SAL_CALL windowPaint (const css::awt::PaintEvent& rEvent) override;
74 // XMouseListener
76 virtual void SAL_CALL mousePressed (const css::awt::MouseEvent& rEvent) override;
78 virtual void SAL_CALL mouseReleased (const css::awt::MouseEvent& rEvent) override;
80 virtual void SAL_CALL mouseEntered (const css::awt::MouseEvent& rEvent) override;
82 virtual void SAL_CALL mouseExited (const css::awt::MouseEvent& rEvent) override;
84 // lang::XEventListener
85 virtual void SAL_CALL disposing (const css::lang::EventObject& rEvent) override;
87 private:
88 ::rtl::Reference<PresenterController> mpPresenterController;
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;
94 const PresenterTheme::SharedFontDescriptor mpFont;
95 const PresenterTheme::SharedFontDescriptor mpMouseOverFont;
96 const OUString msAction;
97 css::geometry::RealPoint2D maCenter;
98 css::geometry::IntegerSize2D maButtonSize;
99 PresenterBitmapDescriptor::Mode meState;
100 css::uno::Reference<css::rendering::XBitmap> mxNormalBitmap;
101 css::uno::Reference<css::rendering::XBitmap> mxMouseOverBitmap;
103 PresenterButton (
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,
108 PresenterTheme::SharedFontDescriptor aFont,
109 PresenterTheme::SharedFontDescriptor aMouseOverFont,
110 OUString sText,
111 OUString sAction);
112 void RenderButton (
113 const css::uno::Reference<css::rendering::XCanvas>& rxCanvas,
114 const css::geometry::IntegerSize2D& rSize,
115 const PresenterTheme::SharedFontDescriptor& rFont,
116 const PresenterBitmapDescriptor::Mode eMode,
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 (
123 const SharedBitmapDescriptor& mpIcon,
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);
130 /// @throws css::lang::DisposedException
131 void ThrowIfDisposed() const;
136 #endif
138 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */