1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef _TEXTLAYOUT_DRAWHELPER_HXX 25 #define _TEXTLAYOUT_DRAWHELPER_HXX 26 27 #include <boost/shared_ptr.hpp> 28 29 #include <com/sun/star/uno/Sequence.hxx> 30 #include <com/sun/star/rendering/StringContext.hpp> 31 #include <com/sun/star/rendering/XCanvasFont.hpp> 32 #include <com/sun/star/geometry/Matrix2D.hpp> 33 #include <com/sun/star/rendering/XGraphicDevice.hpp> 34 35 #include <basegfx/matrix/b2dhommatrix.hxx> 36 #include <basegfx/vector/b2isize.hxx> 37 38 class ::com::sun::star::rendering::XCanvasFont; 39 40 namespace Gdiplus { class Graphics; } 41 42 namespace dxcanvas 43 { 44 struct Bitmap; 45 class TextLayoutDrawHelper 46 { 47 public: 48 TextLayoutDrawHelper( 49 const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& xGraphicDevice); 50 ~TextLayoutDrawHelper(); 51 52 // draw text 53 void drawText( const boost::shared_ptr<Gdiplus::Graphics>& rGraphics, 54 const ::com::sun::star::rendering::ViewState& rViewState, 55 const ::com::sun::star::rendering::RenderState& rRenderState, 56 const ::basegfx::B2ISize& rOutputOffset, 57 const ::com::sun::star::rendering::StringContext& rText, 58 const ::com::sun::star::uno::Sequence< double >& rLogicalAdvancements, 59 const ::com::sun::star::uno::Reference< 60 ::com::sun::star::rendering::XCanvasFont >& rCanvasFont, 61 const ::com::sun::star::geometry::Matrix2D& rFontMatrix, 62 bool bAlphaSurface ); 63 64 ::com::sun::star::geometry::RealRectangle2D queryTextBounds( 65 const ::com::sun::star::rendering::StringContext& rText, 66 const ::com::sun::star::uno::Sequence< double >& rLogicalAdvancements, 67 const ::com::sun::star::uno::Reference< 68 ::com::sun::star::rendering::XCanvasFont >& rCanvasFont, 69 const ::com::sun::star::geometry::Matrix2D& rFontMatrix ); 70 71 #ifdef DBG_UTIL 72 void test(); 73 #endif 74 75 protected: 76 ::com::sun::star::uno::Reference< 77 ::com::sun::star::rendering::XGraphicDevice > mxGraphicDevice; 78 }; 79 } 80 81 #endif /* _TEXTLAYOUT_DRAWHELPER_HXX */ 82 // eof 83