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