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/XCanvas.hpp>
39 #include <com/sun/star/rendering/XCanvasFont.hpp>
40 #include <com/sun/star/rendering/XPolyPolygon2D.hpp>
41 #include <rtl/ref.hxx>
42 #include <boost/noncopyable.hpp>
44 namespace css
= ::com::sun::star
;
46 namespace sdext
{ namespace presenter
{
48 class PresenterController
;
50 /** Collection of functions to ease the life of a canvas user.
52 class PresenterCanvasHelper
53 : ::boost::noncopyable
56 PresenterCanvasHelper (void);
57 ~PresenterCanvasHelper (void);
60 const SharedBitmapDescriptor
& rpBitmap
,
61 const css::uno::Reference
<css::rendering::XCanvas
>& rxCanvas
,
62 const css::awt::Rectangle
& rRepaintBox
,
63 const css::awt::Rectangle
& rBackgroundBoundingBox
,
64 const css::awt::Rectangle
& rContentBoundingBox
) const;
66 static void PaintRectangle (
67 const SharedBitmapDescriptor
& rpBitmap
,
68 const css::uno::Reference
<css::rendering::XCanvas
>& rxCanvas
,
69 const css::awt::Rectangle
& rRepaintBox
,
70 const css::awt::Rectangle
& rBackgroundBoundingBox
,
71 const css::awt::Rectangle
& rContentBoundingBox
,
72 const css::rendering::ViewState
& rDefaultViewState
,
73 const css::rendering::RenderState
& rDefaultRenderState
);
75 static void SetDeviceColor(
76 css::rendering::RenderState
& rRenderState
,
77 const css::util::Color aColor
);
79 static css::geometry::RealSize2D
GetTextSize (
80 const css::uno::Reference
<css::rendering::XCanvasFont
>& rxFont
,
81 const ::rtl::OUString
& rsText
);
84 const css::rendering::ViewState maDefaultViewState
;
85 const css::rendering::RenderState maDefaultRenderState
;
87 static void PaintTiledBitmap (
88 const css::uno::Reference
<css::rendering::XBitmap
>& rxTexture
,
89 const css::uno::Reference
<css::rendering::XCanvas
>& rxCanvas
,
90 const css::awt::Rectangle
& rRepaintBox
,
91 const css::uno::Reference
<css::rendering::XPolyPolygon2D
>& rxPolygon
,
92 const css::awt::Rectangle
& rHole
,
93 const css::rendering::ViewState
& rDefaultViewState
,
94 const css::rendering::RenderState
& rDefaultRenderState
);
96 static void PaintBitmap (
97 const css::uno::Reference
<css::rendering::XBitmap
>& rxBitmap
,
98 const css::awt::Point
& rLocation
,
99 const css::uno::Reference
<css::rendering::XCanvas
>& rxCanvas
,
100 const css::awt::Rectangle
& rRepaintBox
,
101 const css::uno::Reference
<css::rendering::XPolyPolygon2D
>& rxPolygon
,
102 const css::rendering::ViewState
& rDefaultViewState
,
103 const css::rendering::RenderState
& rDefaultRenderState
);
105 static void PaintColor (
106 const css::util::Color nColor
,
107 const css::uno::Reference
<css::rendering::XCanvas
>& rxCanvas
,
108 const css::awt::Rectangle
& rRepaintBox
,
109 const css::uno::Reference
<css::rendering::XPolyPolygon2D
>& rxPolygon
,
110 const css::rendering::ViewState
& rDefaultViewState
,
111 const css::rendering::RenderState
& rDefaultRenderState
);