1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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_PRESENTERCANVASHELPER_HXX
21 #define INCLUDED_SDEXT_SOURCE_PRESENTER_PRESENTERCANVASHELPER_HXX
23 #include "PresenterTheme.hxx"
24 #include <com/sun/star/awt/Point.hpp>
25 #include <com/sun/star/awt/Rectangle.hpp>
26 #include <com/sun/star/rendering/TextDirection.hpp>
27 #include <com/sun/star/rendering/XCanvas.hpp>
28 #include <com/sun/star/rendering/XCanvasFont.hpp>
29 #include <com/sun/star/rendering/XPolyPolygon2D.hpp>
30 #include <rtl/ref.hxx>
31 #include <boost/noncopyable.hpp>
33 namespace sdext
{ namespace presenter
{
35 /** Collection of functions to ease the life of a canvas user.
37 class PresenterCanvasHelper
38 : ::boost::noncopyable
41 PresenterCanvasHelper();
42 ~PresenterCanvasHelper();
45 const SharedBitmapDescriptor
& rpBitmap
,
46 const css::uno::Reference
<css::rendering::XCanvas
>& rxCanvas
,
47 const css::awt::Rectangle
& rRepaintBox
,
48 const css::awt::Rectangle
& rBackgroundBoundingBox
,
49 const css::awt::Rectangle
& rContentBoundingBox
) const;
51 static void PaintRectangle (
52 const SharedBitmapDescriptor
& rpBitmap
,
53 const css::uno::Reference
<css::rendering::XCanvas
>& rxCanvas
,
54 const css::awt::Rectangle
& rRepaintBox
,
55 const css::awt::Rectangle
& rBackgroundBoundingBox
,
56 const css::awt::Rectangle
& rContentBoundingBox
,
57 const css::rendering::ViewState
& rDefaultViewState
,
58 const css::rendering::RenderState
& rDefaultRenderState
);
60 static void SetDeviceColor(
61 css::rendering::RenderState
& rRenderState
,
62 const css::util::Color aColor
);
64 static css::geometry::RealRectangle2D
GetTextBoundingBox (
65 const css::uno::Reference
<css::rendering::XCanvasFont
>& rxFont
,
66 const OUString
& rsText
,
67 const sal_Int8
= css::rendering::TextDirection::WEAK_LEFT_TO_RIGHT
);
69 static css::geometry::RealSize2D
GetTextSize (
70 const css::uno::Reference
<css::rendering::XCanvasFont
>& rxFont
,
71 const OUString
& rsText
,
72 const sal_Int8
= css::rendering::TextDirection::WEAK_LEFT_TO_RIGHT
);
75 const css::rendering::ViewState maDefaultViewState
;
76 const css::rendering::RenderState maDefaultRenderState
;
78 static void PaintTiledBitmap (
79 const css::uno::Reference
<css::rendering::XBitmap
>& rxTexture
,
80 const css::uno::Reference
<css::rendering::XCanvas
>& rxCanvas
,
81 const css::awt::Rectangle
& rRepaintBox
,
82 const css::uno::Reference
<css::rendering::XPolyPolygon2D
>& rxPolygon
,
83 const css::awt::Rectangle
& rHole
,
84 const css::rendering::ViewState
& rDefaultViewState
,
85 const css::rendering::RenderState
& rDefaultRenderState
);
87 static void PaintBitmap (
88 const css::uno::Reference
<css::rendering::XBitmap
>& rxBitmap
,
89 const css::awt::Point
& rLocation
,
90 const css::uno::Reference
<css::rendering::XCanvas
>& rxCanvas
,
91 const css::awt::Rectangle
& rRepaintBox
,
92 const css::uno::Reference
<css::rendering::XPolyPolygon2D
>& rxPolygon
,
93 const css::rendering::ViewState
& rDefaultViewState
,
94 const css::rendering::RenderState
& rDefaultRenderState
);
96 static void PaintColor (
97 const css::util::Color nColor
,
98 const css::uno::Reference
<css::rendering::XCanvas
>& rxCanvas
,
99 const css::awt::Rectangle
& rRepaintBox
,
100 const css::uno::Reference
<css::rendering::XPolyPolygon2D
>& rxPolygon
,
101 const css::rendering::ViewState
& rDefaultViewState
,
102 const css::rendering::RenderState
& rDefaultRenderState
);
109 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */