1*06bcd5d2SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*06bcd5d2SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*06bcd5d2SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*06bcd5d2SAndrew Rist * distributed with this work for additional information 6*06bcd5d2SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*06bcd5d2SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*06bcd5d2SAndrew Rist * "License"); you may not use this file except in compliance 9*06bcd5d2SAndrew Rist * with the License. You may obtain a copy of the License at 10*06bcd5d2SAndrew Rist * 11*06bcd5d2SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*06bcd5d2SAndrew Rist * 13*06bcd5d2SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*06bcd5d2SAndrew Rist * software distributed under the License is distributed on an 15*06bcd5d2SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*06bcd5d2SAndrew Rist * KIND, either express or implied. See the License for the 17*06bcd5d2SAndrew Rist * specific language governing permissions and limitations 18*06bcd5d2SAndrew Rist * under the License. 19*06bcd5d2SAndrew Rist * 20*06bcd5d2SAndrew Rist *************************************************************/ 21*06bcd5d2SAndrew Rist 22*06bcd5d2SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef SDEXT_PRESENTER_PRESENTER_CANVAS_HELPER_HXX 25cdf0e10cSrcweir #define SDEXT_PRESENTER_PRESENTER_CANVAS_HELPER_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include "PresenterTheme.hxx" 28cdf0e10cSrcweir #include <com/sun/star/awt/Point.hpp> 29cdf0e10cSrcweir #include <com/sun/star/awt/Rectangle.hpp> 30cdf0e10cSrcweir #include <com/sun/star/rendering/TextDirection.hpp> 31cdf0e10cSrcweir #include <com/sun/star/rendering/XCanvas.hpp> 32cdf0e10cSrcweir #include <com/sun/star/rendering/XCanvasFont.hpp> 33cdf0e10cSrcweir #include <com/sun/star/rendering/XPolyPolygon2D.hpp> 34cdf0e10cSrcweir #include <rtl/ref.hxx> 35cdf0e10cSrcweir #include <boost/noncopyable.hpp> 36cdf0e10cSrcweir 37cdf0e10cSrcweir namespace css = ::com::sun::star; 38cdf0e10cSrcweir 39cdf0e10cSrcweir namespace sdext { namespace presenter { 40cdf0e10cSrcweir 41cdf0e10cSrcweir class PresenterController; 42cdf0e10cSrcweir 43cdf0e10cSrcweir /** Collection of functions to ease the life of a canvas user. 44cdf0e10cSrcweir */ 45cdf0e10cSrcweir class PresenterCanvasHelper 46cdf0e10cSrcweir : ::boost::noncopyable 47cdf0e10cSrcweir { 48cdf0e10cSrcweir public: 49cdf0e10cSrcweir PresenterCanvasHelper (void); 50cdf0e10cSrcweir ~PresenterCanvasHelper (void); 51cdf0e10cSrcweir 52cdf0e10cSrcweir void Paint ( 53cdf0e10cSrcweir const SharedBitmapDescriptor& rpBitmap, 54cdf0e10cSrcweir const css::uno::Reference<css::rendering::XCanvas>& rxCanvas, 55cdf0e10cSrcweir const css::awt::Rectangle& rRepaintBox, 56cdf0e10cSrcweir const css::awt::Rectangle& rBackgroundBoundingBox, 57cdf0e10cSrcweir const css::awt::Rectangle& rContentBoundingBox) const; 58cdf0e10cSrcweir 59cdf0e10cSrcweir static void PaintRectangle ( 60cdf0e10cSrcweir const SharedBitmapDescriptor& rpBitmap, 61cdf0e10cSrcweir const css::uno::Reference<css::rendering::XCanvas>& rxCanvas, 62cdf0e10cSrcweir const css::awt::Rectangle& rRepaintBox, 63cdf0e10cSrcweir const css::awt::Rectangle& rBackgroundBoundingBox, 64cdf0e10cSrcweir const css::awt::Rectangle& rContentBoundingBox, 65cdf0e10cSrcweir const css::rendering::ViewState& rDefaultViewState, 66cdf0e10cSrcweir const css::rendering::RenderState& rDefaultRenderState); 67cdf0e10cSrcweir 68cdf0e10cSrcweir static void SetDeviceColor( 69cdf0e10cSrcweir css::rendering::RenderState& rRenderState, 70cdf0e10cSrcweir const css::util::Color aColor); 71cdf0e10cSrcweir 72cdf0e10cSrcweir static css::geometry::RealRectangle2D GetTextBoundingBox ( 73cdf0e10cSrcweir const css::uno::Reference<css::rendering::XCanvasFont>& rxFont, 74cdf0e10cSrcweir const ::rtl::OUString& rsText, 75cdf0e10cSrcweir const sal_Int8 = css::rendering::TextDirection::WEAK_LEFT_TO_RIGHT); 76cdf0e10cSrcweir 77cdf0e10cSrcweir static css::geometry::RealSize2D GetTextSize ( 78cdf0e10cSrcweir const css::uno::Reference<css::rendering::XCanvasFont>& rxFont, 79cdf0e10cSrcweir const ::rtl::OUString& rsText, 80cdf0e10cSrcweir const sal_Int8 = css::rendering::TextDirection::WEAK_LEFT_TO_RIGHT); 81cdf0e10cSrcweir 82cdf0e10cSrcweir private: 83cdf0e10cSrcweir const css::rendering::ViewState maDefaultViewState; 84cdf0e10cSrcweir const css::rendering::RenderState maDefaultRenderState; 85cdf0e10cSrcweir 86cdf0e10cSrcweir static void PaintTiledBitmap ( 87cdf0e10cSrcweir const css::uno::Reference<css::rendering::XBitmap>& rxTexture, 88cdf0e10cSrcweir const css::uno::Reference<css::rendering::XCanvas>& rxCanvas, 89cdf0e10cSrcweir const css::awt::Rectangle& rRepaintBox, 90cdf0e10cSrcweir const css::uno::Reference<css::rendering::XPolyPolygon2D>& rxPolygon, 91cdf0e10cSrcweir const css::awt::Rectangle& rHole, 92cdf0e10cSrcweir const css::rendering::ViewState& rDefaultViewState, 93cdf0e10cSrcweir const css::rendering::RenderState& rDefaultRenderState); 94cdf0e10cSrcweir 95cdf0e10cSrcweir static void PaintBitmap ( 96cdf0e10cSrcweir const css::uno::Reference<css::rendering::XBitmap>& rxBitmap, 97cdf0e10cSrcweir const css::awt::Point& rLocation, 98cdf0e10cSrcweir const css::uno::Reference<css::rendering::XCanvas>& rxCanvas, 99cdf0e10cSrcweir const css::awt::Rectangle& rRepaintBox, 100cdf0e10cSrcweir const css::uno::Reference<css::rendering::XPolyPolygon2D>& rxPolygon, 101cdf0e10cSrcweir const css::rendering::ViewState& rDefaultViewState, 102cdf0e10cSrcweir const css::rendering::RenderState& rDefaultRenderState); 103cdf0e10cSrcweir 104cdf0e10cSrcweir static void PaintColor ( 105cdf0e10cSrcweir const css::util::Color nColor, 106cdf0e10cSrcweir const css::uno::Reference<css::rendering::XCanvas>& rxCanvas, 107cdf0e10cSrcweir const css::awt::Rectangle& rRepaintBox, 108cdf0e10cSrcweir const css::uno::Reference<css::rendering::XPolyPolygon2D>& rxPolygon, 109cdf0e10cSrcweir const css::rendering::ViewState& rDefaultViewState, 110cdf0e10cSrcweir const css::rendering::RenderState& rDefaultRenderState); 111cdf0e10cSrcweir }; 112cdf0e10cSrcweir 113cdf0e10cSrcweir } } 114cdf0e10cSrcweir 115cdf0e10cSrcweir #endif 116