1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: PresenterCanvasHelper.hxx,v $
13 * This file is part of OpenOffice.org.
15 * OpenOffice.org is free software: you can redistribute it and/or modify
16 * it under the terms of the GNU Lesser General Public License version 3
17 * only, as published by the Free Software Foundation.
19 * OpenOffice.org is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU Lesser General Public License version 3 for more details
23 * (a copy is included in the LICENSE file that accompanied this code).
25 * You should have received a copy of the GNU Lesser General Public License
26 * version 3 along with OpenOffice.org. If not, see
27 * <http://www.openoffice.org/license.html>
28 * for a copy of the LGPLv3 License.
30 ************************************************************************/
32 #ifndef SDEXT_PRESENTER_PRESENTER_CANVAS_HELPER_HXX
33 #define SDEXT_PRESENTER_PRESENTER_CANVAS_HELPER_HXX
35 #include "PresenterTheme.hxx"
36 #include <com/sun/star/awt/Point.hpp>
37 #include <com/sun/star/awt/Rectangle.hpp>
38 #include <com/sun/star/rendering/TextDirection.hpp>
39 #include <com/sun/star/rendering/XCanvas.hpp>
40 #include <com/sun/star/rendering/XCanvasFont.hpp>
41 #include <com/sun/star/rendering/XPolyPolygon2D.hpp>
42 #include <rtl/ref.hxx>
43 #include <boost/noncopyable.hpp>
45 namespace css
= ::com::sun::star
;
47 namespace sdext
{ namespace presenter
{
49 class PresenterController
;
51 /** Collection of functions to ease the life of a canvas user.
53 class PresenterCanvasHelper
54 : ::boost::noncopyable
57 PresenterCanvasHelper (void);
58 ~PresenterCanvasHelper (void);
61 const SharedBitmapDescriptor
& rpBitmap
,
62 const css::uno::Reference
<css::rendering::XCanvas
>& rxCanvas
,
63 const css::awt::Rectangle
& rRepaintBox
,
64 const css::awt::Rectangle
& rBackgroundBoundingBox
,
65 const css::awt::Rectangle
& rContentBoundingBox
) const;
67 static void PaintRectangle (
68 const SharedBitmapDescriptor
& rpBitmap
,
69 const css::uno::Reference
<css::rendering::XCanvas
>& rxCanvas
,
70 const css::awt::Rectangle
& rRepaintBox
,
71 const css::awt::Rectangle
& rBackgroundBoundingBox
,
72 const css::awt::Rectangle
& rContentBoundingBox
,
73 const css::rendering::ViewState
& rDefaultViewState
,
74 const css::rendering::RenderState
& rDefaultRenderState
);
76 static void SetDeviceColor(
77 css::rendering::RenderState
& rRenderState
,
78 const css::util::Color aColor
);
80 static css::geometry::RealRectangle2D
GetTextBoundingBox (
81 const css::uno::Reference
<css::rendering::XCanvasFont
>& rxFont
,
82 const ::rtl::OUString
& rsText
,
83 const sal_Int8
= css::rendering::TextDirection::WEAK_LEFT_TO_RIGHT
);
85 static css::geometry::RealSize2D
GetTextSize (
86 const css::uno::Reference
<css::rendering::XCanvasFont
>& rxFont
,
87 const ::rtl::OUString
& rsText
,
88 const sal_Int8
= css::rendering::TextDirection::WEAK_LEFT_TO_RIGHT
);
91 const css::rendering::ViewState maDefaultViewState
;
92 const css::rendering::RenderState maDefaultRenderState
;
94 static void PaintTiledBitmap (
95 const css::uno::Reference
<css::rendering::XBitmap
>& rxTexture
,
96 const css::uno::Reference
<css::rendering::XCanvas
>& rxCanvas
,
97 const css::awt::Rectangle
& rRepaintBox
,
98 const css::uno::Reference
<css::rendering::XPolyPolygon2D
>& rxPolygon
,
99 const css::awt::Rectangle
& rHole
,
100 const css::rendering::ViewState
& rDefaultViewState
,
101 const css::rendering::RenderState
& rDefaultRenderState
);
103 static void PaintBitmap (
104 const css::uno::Reference
<css::rendering::XBitmap
>& rxBitmap
,
105 const css::awt::Point
& rLocation
,
106 const css::uno::Reference
<css::rendering::XCanvas
>& rxCanvas
,
107 const css::awt::Rectangle
& rRepaintBox
,
108 const css::uno::Reference
<css::rendering::XPolyPolygon2D
>& rxPolygon
,
109 const css::rendering::ViewState
& rDefaultViewState
,
110 const css::rendering::RenderState
& rDefaultRenderState
);
112 static void PaintColor (
113 const css::util::Color nColor
,
114 const css::uno::Reference
<css::rendering::XCanvas
>& rxCanvas
,
115 const css::awt::Rectangle
& rRepaintBox
,
116 const css::uno::Reference
<css::rendering::XPolyPolygon2D
>& rxPolygon
,
117 const css::rendering::ViewState
& rDefaultViewState
,
118 const css::rendering::RenderState
& rDefaultRenderState
);