1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef _TEXTLAYOUT_DRAWHELPER_HXX
29 #define _TEXTLAYOUT_DRAWHELPER_HXX
30 
31 #include <boost/shared_ptr.hpp>
32 
33 #include <com/sun/star/uno/Sequence.hxx>
34 #include <com/sun/star/rendering/StringContext.hpp>
35 #include <com/sun/star/rendering/XCanvasFont.hpp>
36 #include <com/sun/star/geometry/Matrix2D.hpp>
37 #include <com/sun/star/rendering/XGraphicDevice.hpp>
38 
39 #include <basegfx/matrix/b2dhommatrix.hxx>
40 #include <basegfx/vector/b2isize.hxx>
41 
42 class ::com::sun::star::rendering::XCanvasFont;
43 
44 namespace Gdiplus { class Graphics; }
45 
46 namespace dxcanvas
47 {
48 	struct Bitmap;
49 	class TextLayoutDrawHelper
50 	{
51 	public:
52 		TextLayoutDrawHelper(
53 			const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& xGraphicDevice);
54 		~TextLayoutDrawHelper();
55 
56 		// draw text
57 		void drawText( const boost::shared_ptr<Gdiplus::Graphics>&          rGraphics,
58                        const ::com::sun::star::rendering::ViewState& 		rViewState,
59                        const ::com::sun::star::rendering::RenderState& 		rRenderState,
60                        const ::basegfx::B2ISize& 							rOutputOffset,
61                        const ::com::sun::star::rendering::StringContext& 	rText,
62                        const ::com::sun::star::uno::Sequence< double >& 	rLogicalAdvancements,
63                        const ::com::sun::star::uno::Reference<
64                        		::com::sun::star::rendering::XCanvasFont >& 	rCanvasFont,
65                        const ::com::sun::star::geometry::Matrix2D& 			rFontMatrix,
66                        bool                                                 bAlphaSurface );
67 
68         ::com::sun::star::geometry::RealRectangle2D queryTextBounds(
69 			const ::com::sun::star::rendering::StringContext& 	rText,
70             const ::com::sun::star::uno::Sequence< double >& 	rLogicalAdvancements,
71             const ::com::sun::star::uno::Reference<
72 	            ::com::sun::star::rendering::XCanvasFont >&		rCanvasFont,
73               const ::com::sun::star::geometry::Matrix2D& 		rFontMatrix );
74 
75 #ifdef DBG_UTIL
76 		void test();
77 #endif
78 
79     protected:
80 		::com::sun::star::uno::Reference<
81   			::com::sun::star::rendering::XGraphicDevice >	mxGraphicDevice;
82 	};
83 }
84 
85 #endif /* _TEXTLAYOUT_DRAWHELPER_HXX */
86 // eof
87