Version 6.1.0.2, tag libreoffice-6.1.0.2
[LibreOffice.git] / sdext / source / presenter / PresenterPaneBorderPainter.hxx
blob467926d5469dd1332ea10e0607ecce9fc1dca4d7
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_PRESENTERPANEBORDERPAINTER_HXX
21 #define INCLUDED_SDEXT_SOURCE_PRESENTER_PRESENTERPANEBORDERPAINTER_HXX
23 #include <com/sun/star/uno/XComponentContext.hpp>
24 #include <com/sun/star/awt/Rectangle.hpp>
25 #include <com/sun/star/drawing/framework/XPaneBorderPainter.hpp>
26 #include <com/sun/star/graphic/XGraphicProvider.hpp>
27 #include <com/sun/star/rendering/XCanvas.hpp>
28 #include <com/sun/star/util/XMacroExpander.hpp>
29 #include <com/sun/star/awt/XGraphics.hpp>
30 #include <cppuhelper/basemutex.hxx>
31 #include <cppuhelper/compbase.hxx>
32 #include <memory>
34 namespace sdext { namespace presenter {
36 class PresenterPane;
37 class PresenterTheme;
39 typedef ::cppu::WeakComponentImplHelper<
40 css::drawing::framework::XPaneBorderPainter
41 > PresenterPaneBorderPainterInterfaceBase;
43 /** This class is responsible for painting window borders of PresenterPane
44 objects.
46 class PresenterPaneBorderPainter
47 : protected ::cppu::BaseMutex,
48 public PresenterPaneBorderPainterInterfaceBase
50 public:
51 explicit PresenterPaneBorderPainter (
52 const css::uno::Reference<css::uno::XComponentContext>& rxContext);
53 virtual ~PresenterPaneBorderPainter() override;
54 PresenterPaneBorderPainter(const PresenterPaneBorderPainter&) = delete;
55 PresenterPaneBorderPainter& operator=(const PresenterPaneBorderPainter&) = delete;
57 /** Transform the bounding box of the window content to the outer
58 bounding box of the border that is painted around it.
59 @param rsPaneURL
60 Specifies the pane style that is used to determine the border sizes.
61 @param rInnerBox
62 The rectangle of the inner window content.
64 css::awt::Rectangle AddBorder (
65 const OUString& rsPaneURL,
66 const css::awt::Rectangle& rInnerBox,
67 const css::drawing::framework::BorderType eBorderType) const;
69 /** Transform the outer bounding box of a window to the bounding box of
70 the inner content area.
71 @param rsPaneURL
72 Specifies the pane style that is used to determine the border sizes.
73 @param rOuterBox
74 The bounding box of the rectangle around the window.
75 @param bIsTitleVisible
76 This flag controls whether the upper part of the frame is
77 supposed to contain the window title.
79 css::awt::Rectangle RemoveBorder (
80 const OUString& rsPaneURL,
81 const css::awt::Rectangle& rOuterBox,
82 const css::drawing::framework::BorderType eBorderType) const;
84 void SetTheme (const std::shared_ptr<PresenterTheme>& rpTheme);
86 class Renderer;
88 // XPaneBorderPainter
90 virtual css::awt::Rectangle SAL_CALL addBorder (
91 const OUString& rsPaneBorderStyleName,
92 const css::awt::Rectangle& rRectangle,
93 css::drawing::framework::BorderType eBorderType) override;
95 virtual css::awt::Rectangle SAL_CALL removeBorder (
96 const OUString& rsPaneBorderStyleName,
97 const css::awt::Rectangle& rRectangle,
98 css::drawing::framework::BorderType eBorderType) override;
100 virtual void SAL_CALL paintBorder (
101 const OUString& rsPaneBorderStyleName,
102 const css::uno::Reference<css::rendering::XCanvas>& rxCanvas,
103 const css::awt::Rectangle& rOuterBorderRectangle,
104 const css::awt::Rectangle& rRepaintArea,
105 const OUString& rsTitle) override;
107 virtual void SAL_CALL paintBorderWithCallout (
108 const OUString& rsPaneBorderStyleName,
109 const css::uno::Reference<css::rendering::XCanvas>& rxCanvas,
110 const css::awt::Rectangle& rOuterBorderRectangle,
111 const css::awt::Rectangle& rRepaintArea,
112 const OUString& rsTitle,
113 const css::awt::Point& rCalloutAnchor) override;
115 virtual css::awt::Point SAL_CALL getCalloutOffset (
116 const OUString& rsPaneBorderStyleName) override;
118 private:
119 css::uno::Reference<css::uno::XComponentContext> mxContext;
120 std::shared_ptr<PresenterTheme> mpTheme;
121 std::unique_ptr<Renderer> mpRenderer;
123 /** When the theme for the border has not yet been loaded then try again
124 when this method is called.
125 @return
126 Returns <TRUE/> only one time when the theme is loaded and/or the
127 renderer is initialized.
129 bool ProvideTheme (
130 const css::uno::Reference<css::rendering::XCanvas>& rxCanvas);
131 void ProvideTheme();
133 /// @throws css::lang::DisposedException
134 void ThrowIfDisposed() const;
137 } } // end of namespace ::sd::presenter
139 #endif
141 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */