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 SDEXT_PRESENTER_PRESENTER_CANVAS_HELPER_HXX 29 #define SDEXT_PRESENTER_PRESENTER_CANVAS_HELPER_HXX 30 31 #include "PresenterTheme.hxx" 32 #include <com/sun/star/awt/Point.hpp> 33 #include <com/sun/star/awt/Rectangle.hpp> 34 #include <com/sun/star/rendering/TextDirection.hpp> 35 #include <com/sun/star/rendering/XCanvas.hpp> 36 #include <com/sun/star/rendering/XCanvasFont.hpp> 37 #include <com/sun/star/rendering/XPolyPolygon2D.hpp> 38 #include <rtl/ref.hxx> 39 #include <boost/noncopyable.hpp> 40 41 namespace css = ::com::sun::star; 42 43 namespace sdext { namespace presenter { 44 45 class PresenterController; 46 47 /** Collection of functions to ease the life of a canvas user. 48 */ 49 class PresenterCanvasHelper 50 : ::boost::noncopyable 51 { 52 public: 53 PresenterCanvasHelper (void); 54 ~PresenterCanvasHelper (void); 55 56 void Paint ( 57 const SharedBitmapDescriptor& rpBitmap, 58 const css::uno::Reference<css::rendering::XCanvas>& rxCanvas, 59 const css::awt::Rectangle& rRepaintBox, 60 const css::awt::Rectangle& rBackgroundBoundingBox, 61 const css::awt::Rectangle& rContentBoundingBox) const; 62 63 static void PaintRectangle ( 64 const SharedBitmapDescriptor& rpBitmap, 65 const css::uno::Reference<css::rendering::XCanvas>& rxCanvas, 66 const css::awt::Rectangle& rRepaintBox, 67 const css::awt::Rectangle& rBackgroundBoundingBox, 68 const css::awt::Rectangle& rContentBoundingBox, 69 const css::rendering::ViewState& rDefaultViewState, 70 const css::rendering::RenderState& rDefaultRenderState); 71 72 static void SetDeviceColor( 73 css::rendering::RenderState& rRenderState, 74 const css::util::Color aColor); 75 76 static css::geometry::RealRectangle2D GetTextBoundingBox ( 77 const css::uno::Reference<css::rendering::XCanvasFont>& rxFont, 78 const ::rtl::OUString& rsText, 79 const sal_Int8 = css::rendering::TextDirection::WEAK_LEFT_TO_RIGHT); 80 81 static css::geometry::RealSize2D GetTextSize ( 82 const css::uno::Reference<css::rendering::XCanvasFont>& rxFont, 83 const ::rtl::OUString& rsText, 84 const sal_Int8 = css::rendering::TextDirection::WEAK_LEFT_TO_RIGHT); 85 86 private: 87 const css::rendering::ViewState maDefaultViewState; 88 const css::rendering::RenderState maDefaultRenderState; 89 90 static void PaintTiledBitmap ( 91 const css::uno::Reference<css::rendering::XBitmap>& rxTexture, 92 const css::uno::Reference<css::rendering::XCanvas>& rxCanvas, 93 const css::awt::Rectangle& rRepaintBox, 94 const css::uno::Reference<css::rendering::XPolyPolygon2D>& rxPolygon, 95 const css::awt::Rectangle& rHole, 96 const css::rendering::ViewState& rDefaultViewState, 97 const css::rendering::RenderState& rDefaultRenderState); 98 99 static void PaintBitmap ( 100 const css::uno::Reference<css::rendering::XBitmap>& rxBitmap, 101 const css::awt::Point& rLocation, 102 const css::uno::Reference<css::rendering::XCanvas>& rxCanvas, 103 const css::awt::Rectangle& rRepaintBox, 104 const css::uno::Reference<css::rendering::XPolyPolygon2D>& rxPolygon, 105 const css::rendering::ViewState& rDefaultViewState, 106 const css::rendering::RenderState& rDefaultRenderState); 107 108 static void PaintColor ( 109 const css::util::Color nColor, 110 const css::uno::Reference<css::rendering::XCanvas>& rxCanvas, 111 const css::awt::Rectangle& rRepaintBox, 112 const css::uno::Reference<css::rendering::XPolyPolygon2D>& rxPolygon, 113 const css::rendering::ViewState& rDefaultViewState, 114 const css::rendering::RenderState& rDefaultRenderState); 115 }; 116 117 } } 118 119 #endif 120