LCOV - code coverage report
Current view: top level - sd/source/ui/presenter - PresenterCanvas.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 15 326 4.6 %
Date: 2014-04-11 Functions: 7 60 11.7 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : 
      21             : #include "PresenterCanvas.hxx"
      22             : 
      23             : #include <basegfx/matrix/b2dhommatrix.hxx>
      24             : #include <basegfx/polygon/b2dpolygontools.hxx>
      25             : #include <basegfx/polygon/b2dpolypolygon.hxx>
      26             : #include <basegfx/polygon/b2dpolygonclipper.hxx>
      27             : #include <basegfx/range/b2drectangle.hxx>
      28             : #include <basegfx/tools/canvastools.hxx>
      29             : #include <canvas/canvastools.hxx>
      30             : #include <cppuhelper/basemutex.hxx>
      31             : #include <cppuhelper/compbase1.hxx>
      32             : #include <rtl/ref.hxx>
      33             : #include <toolkit/helper/vclunohelper.hxx>
      34             : #include <vcl/window.hxx>
      35             : #include <vcl/svapp.hxx>
      36             : 
      37             : using namespace ::com::sun::star;
      38             : using namespace ::com::sun::star::uno;
      39             : 
      40             : namespace sd { namespace presenter {
      41             : 
      42             : //===== Service ===============================================================
      43             : 
      44           1 : Reference<XInterface> SAL_CALL PresenterCanvas_createInstance (
      45             :     const Reference<XComponentContext>& rxContext)
      46             : {
      47             :     (void)rxContext;
      48           1 :     return Reference<XInterface>(static_cast<XWeak*>(new PresenterCanvas()));
      49             : }
      50             : 
      51             : 
      52             : 
      53             : 
      54          16 : OUString PresenterCanvas_getImplementationName (void) throw(RuntimeException)
      55             : {
      56          16 :     return OUString("com.sun.star.comp.Draw.PresenterCanvasFactory");
      57             : }
      58             : 
      59             : 
      60             : 
      61             : 
      62           1 : Sequence<OUString> SAL_CALL PresenterCanvas_getSupportedServiceNames (void)
      63             :     throw (RuntimeException)
      64             : {
      65           1 :     static const OUString sServiceName("com.sun.star.rendering.Canvas");
      66           1 :     return Sequence<OUString>(&sServiceName, 1);
      67             : }
      68             : 
      69             : 
      70             : 
      71             : 
      72             : //===== PresenterCustomSprite =================================================
      73             : 
      74             : /** Wrapper around a sprite that is displayed on a PresenterCanvas.
      75             : */
      76             : namespace {
      77             :     typedef ::cppu::WeakComponentImplHelper1 <
      78             :         css::rendering::XCustomSprite
      79             :     > PresenterCustomSpriteInterfaceBase;
      80             : }
      81             : class PresenterCustomSprite
      82             :     : private ::boost::noncopyable,
      83             :       protected ::cppu::BaseMutex,
      84             :       public PresenterCustomSpriteInterfaceBase
      85             : {
      86             : public:
      87             :     PresenterCustomSprite (
      88             :         const rtl::Reference<PresenterCanvas>& rpCanvas,
      89             :         const Reference<rendering::XCustomSprite>& rxSprite,
      90             :         const Reference<awt::XWindow>& rxBaseWindow,
      91             :         const css::geometry::RealSize2D& rSpriteSize);
      92             :     virtual ~PresenterCustomSprite (void);
      93             :     virtual void SAL_CALL disposing (void)
      94             :         throw (RuntimeException) SAL_OVERRIDE;
      95             : 
      96             :     // XSprite
      97             : 
      98             :     virtual void SAL_CALL setAlpha (double nAlpha)
      99             :         throw (lang::IllegalArgumentException,RuntimeException, std::exception) SAL_OVERRIDE;
     100             : 
     101             :     virtual void SAL_CALL move (const geometry::RealPoint2D& rNewPos,
     102             :         const rendering::ViewState& rViewState,
     103             :         const rendering::RenderState& rRenderState)
     104             :         throw (lang::IllegalArgumentException,RuntimeException, std::exception) SAL_OVERRIDE;
     105             : 
     106             :     virtual void SAL_CALL transform (const geometry::AffineMatrix2D& rTransformation)
     107             :         throw (lang::IllegalArgumentException,RuntimeException, std::exception) SAL_OVERRIDE;
     108             : 
     109             :     virtual void SAL_CALL clip (const Reference<rendering::XPolyPolygon2D>& rClip)
     110             :         throw (RuntimeException, std::exception) SAL_OVERRIDE;
     111             : 
     112             :     virtual void SAL_CALL setPriority (double nPriority)
     113             :         throw (RuntimeException, std::exception) SAL_OVERRIDE;
     114             : 
     115             :     virtual void SAL_CALL show (void)
     116             :         throw (RuntimeException, std::exception) SAL_OVERRIDE;
     117             : 
     118             :     virtual void SAL_CALL hide (void)
     119             :         throw (RuntimeException, std::exception) SAL_OVERRIDE;
     120             : 
     121             : 
     122             :     // XCustomSprite
     123             : 
     124             :     virtual Reference<rendering::XCanvas> SAL_CALL getContentCanvas (void)
     125             :         throw (RuntimeException, std::exception) SAL_OVERRIDE;
     126             : 
     127             : private:
     128             :     rtl::Reference<PresenterCanvas> mpCanvas;
     129             :     Reference<rendering::XCustomSprite> mxSprite;
     130             :     Reference<awt::XWindow> mxBaseWindow;
     131             :     geometry::RealPoint2D maPosition;
     132             :     geometry::RealSize2D maSpriteSize;
     133             : 
     134             :     void ThrowIfDisposed (void)
     135             :         throw (css::lang::DisposedException);
     136             : };
     137             : 
     138             : 
     139             : 
     140             : 
     141             : //===== PresenterCanvas =======================================================
     142             : 
     143             : 
     144           1 : PresenterCanvas::PresenterCanvas (void)
     145             :     : PresenterCanvasInterfaceBase(m_aMutex),
     146             :       mxUpdateCanvas(),
     147             :       mxSharedCanvas(),
     148             :       mxSharedWindow(),
     149             :       mxWindow(),
     150             :       maOffset(),
     151             :       mpUpdateRequester(),
     152             :       maClipRectangle(),
     153           1 :       mbOffsetUpdatePending(true)
     154             : {
     155           1 : }
     156             : 
     157             : 
     158             : 
     159             : 
     160           0 : PresenterCanvas::PresenterCanvas (
     161             :     const Reference<rendering::XSpriteCanvas>& rxUpdateCanvas,
     162             :     const Reference<awt::XWindow>& rxUpdateWindow,
     163             :     const Reference<rendering::XCanvas>& rxSharedCanvas,
     164             :     const Reference<awt::XWindow>& rxSharedWindow,
     165             :     const Reference<awt::XWindow>& rxWindow)
     166             :     : PresenterCanvasInterfaceBase(m_aMutex),
     167             :       mxUpdateCanvas(rxUpdateCanvas),
     168             :       mxUpdateWindow(rxUpdateWindow),
     169             :       mxSharedCanvas(rxSharedCanvas),
     170             :       mxSharedWindow(rxSharedWindow),
     171             :       mxWindow(rxWindow),
     172             :       maOffset(),
     173             :       mpUpdateRequester(),
     174             :       maClipRectangle(),
     175           0 :       mbOffsetUpdatePending(true)
     176             : {
     177           0 :     if (mxWindow.is())
     178           0 :         mxWindow->addWindowListener(this);
     179             : 
     180           0 :     if (mxUpdateCanvas.is())
     181           0 :         mpUpdateRequester = CanvasUpdateRequester::Instance(mxUpdateCanvas);
     182           0 : }
     183             : 
     184             : 
     185             : 
     186             : 
     187           2 : PresenterCanvas::~PresenterCanvas (void)
     188             : {
     189           2 : }
     190             : 
     191             : 
     192             : 
     193             : 
     194           1 : void SAL_CALL PresenterCanvas::disposing (void)
     195             :     throw (css::uno::RuntimeException)
     196             : {
     197           1 :     if (mxWindow.is())
     198           0 :         mxWindow->removeWindowListener(this);
     199           1 : }
     200             : 
     201             : 
     202             : 
     203             : 
     204             : //----- XInitialization -------------------------------------------------------
     205             : 
     206           0 : void SAL_CALL PresenterCanvas::initialize (
     207             :     const Sequence<Any>& rArguments)
     208             :     throw(Exception, RuntimeException, std::exception)
     209             : {
     210           0 :     if (rBHelper.bDisposed || rBHelper.bInDispose)
     211           0 :         ThrowIfDisposed();
     212             : 
     213           0 :     if (rArguments.getLength() == 5)
     214             :     {
     215             :         try
     216             :         {
     217             :             // First and second argument may be NULL.
     218           0 :             rArguments[0] >>= mxUpdateCanvas;
     219           0 :             rArguments[1] >>= mxUpdateWindow;
     220             : 
     221           0 :             if ( ! (rArguments[2] >>= mxSharedWindow))
     222             :             {
     223             :                 throw lang::IllegalArgumentException("PresenterCanvas: invalid shared window",
     224             :                     static_cast<XWeak*>(this),
     225           0 :                     1);
     226             :             }
     227             : 
     228           0 :             if ( ! (rArguments[3] >>= mxSharedCanvas))
     229             :             {
     230             :                 throw lang::IllegalArgumentException("PresenterCanvas: invalid shared canvas",
     231             :                     static_cast<XWeak*>(this),
     232           0 :                     2);
     233             :             }
     234             : 
     235           0 :             if ( ! (rArguments[4] >>= mxWindow))
     236             :             {
     237             :                 throw lang::IllegalArgumentException("PresenterCanvas: invalid window",
     238             :                     static_cast<XWeak*>(this),
     239           0 :                     3);
     240             :             }
     241             : 
     242           0 :             mpUpdateRequester = CanvasUpdateRequester::Instance(mxUpdateCanvas);
     243             : 
     244           0 :             mbOffsetUpdatePending = true;
     245           0 :             if (mxWindow.is())
     246           0 :                 mxWindow->addWindowListener(this);
     247             :         }
     248           0 :         catch (RuntimeException&)
     249             :         {
     250           0 :             mxSharedWindow = NULL;
     251           0 :             mxWindow = NULL;
     252           0 :             throw;
     253             :         }
     254             :     }
     255             :     else
     256             :     {
     257             :         throw RuntimeException("PresenterCanvas: invalid number of arguments",
     258           0 :                 static_cast<XWeak*>(this));
     259             :     }
     260           0 : }
     261             : 
     262             : 
     263             : 
     264             : 
     265             : //----- XCanvas ---------------------------------------------------------------
     266             : 
     267           0 : void SAL_CALL PresenterCanvas::clear (void)
     268             :     throw (css::uno::RuntimeException, std::exception)
     269             : {
     270           0 :     ThrowIfDisposed();
     271             :     // ToDo: Clear the area covered by the child window.  A simple forward
     272             :     // would clear the whole shared canvas.
     273           0 : }
     274             : 
     275             : 
     276             : 
     277             : 
     278           0 : void SAL_CALL PresenterCanvas::drawPoint (
     279             :     const css::geometry::RealPoint2D& aPoint,
     280             :     const css::rendering::ViewState& aViewState,
     281             :     const css::rendering::RenderState& aRenderState)
     282             :     throw (css::lang::IllegalArgumentException, css::uno::RuntimeException, std::exception)
     283             : {
     284           0 :     ThrowIfDisposed();
     285           0 :     mxSharedCanvas->drawPoint(aPoint,MergeViewState(aViewState),aRenderState);
     286           0 : }
     287             : 
     288             : 
     289             : 
     290             : 
     291           0 : void SAL_CALL PresenterCanvas::drawLine (
     292             :         const css::geometry::RealPoint2D& aStartPoint,
     293             :         const css::geometry::RealPoint2D& aEndPoint,
     294             :         const css::rendering::ViewState& aViewState,
     295             :         const css::rendering::RenderState& aRenderState)
     296             :         throw (css::lang::IllegalArgumentException, css::uno::RuntimeException, std::exception)
     297             : {
     298           0 :     ThrowIfDisposed();
     299           0 :     mxSharedCanvas->drawLine(aStartPoint,aEndPoint,MergeViewState(aViewState),aRenderState);
     300           0 : }
     301             : 
     302             : 
     303             : 
     304             : 
     305           0 : void SAL_CALL PresenterCanvas::drawBezier (
     306             :         const css::geometry::RealBezierSegment2D& aBezierSegment,
     307             :         const css::geometry::RealPoint2D& aEndPoint,
     308             :         const css::rendering::ViewState& aViewState,
     309             :         const css::rendering::RenderState& aRenderState)
     310             :         throw (css::lang::IllegalArgumentException, css::uno::RuntimeException, std::exception)
     311             : {
     312           0 :     ThrowIfDisposed();
     313           0 :     mxSharedCanvas->drawBezier(aBezierSegment,aEndPoint,MergeViewState(aViewState),aRenderState);
     314           0 : }
     315             : 
     316             : 
     317             : 
     318             : 
     319           0 : css::uno::Reference<css::rendering::XCachedPrimitive> SAL_CALL PresenterCanvas::drawPolyPolygon (
     320             :         const css::uno::Reference< css::rendering::XPolyPolygon2D >& xPolyPolygon,
     321             :         const css::rendering::ViewState& aViewState,
     322             :         const css::rendering::RenderState& aRenderState)
     323             :         throw (css::lang::IllegalArgumentException, css::uno::RuntimeException, std::exception)
     324             : {
     325           0 :     ThrowIfDisposed();
     326           0 :     return mxSharedCanvas->drawPolyPolygon(
     327           0 :         xPolyPolygon, MergeViewState(aViewState), aRenderState);
     328             : }
     329             : 
     330             : 
     331             : 
     332             : 
     333           0 : css::uno::Reference<css::rendering::XCachedPrimitive> SAL_CALL PresenterCanvas::strokePolyPolygon (
     334             :         const css::uno::Reference< css::rendering::XPolyPolygon2D >& xPolyPolygon,
     335             :         const css::rendering::ViewState& aViewState,
     336             :         const css::rendering::RenderState& aRenderState,
     337             :         const css::rendering::StrokeAttributes& aStrokeAttributes)
     338             :         throw (css::lang::IllegalArgumentException, css::uno::RuntimeException, std::exception)
     339             : {
     340           0 :     ThrowIfDisposed();
     341           0 :     return mxSharedCanvas->strokePolyPolygon(
     342           0 :         xPolyPolygon, MergeViewState(aViewState), aRenderState, aStrokeAttributes);
     343             : }
     344             : 
     345             : 
     346             : 
     347             : 
     348             : css::uno::Reference<css::rendering::XCachedPrimitive> SAL_CALL
     349           0 :         PresenterCanvas::strokeTexturedPolyPolygon (
     350             :             const css::uno::Reference< css::rendering::XPolyPolygon2D >& xPolyPolygon,
     351             :             const css::rendering::ViewState& aViewState,
     352             :             const css::rendering::RenderState& aRenderState,
     353             :             const css::uno::Sequence< css::rendering::Texture >& aTextures,
     354             :             const css::rendering::StrokeAttributes& aStrokeAttributes)
     355             :         throw (css::lang::IllegalArgumentException,
     356             :             css::rendering::VolatileContentDestroyedException,
     357             :             css::uno::RuntimeException, std::exception)
     358             : {
     359           0 :     ThrowIfDisposed();
     360           0 :     return mxSharedCanvas->strokeTexturedPolyPolygon(
     361           0 :         xPolyPolygon, MergeViewState(aViewState), aRenderState, aTextures, aStrokeAttributes);
     362             : }
     363             : 
     364             : 
     365             : 
     366             : 
     367             : css::uno::Reference<css::rendering::XCachedPrimitive> SAL_CALL
     368           0 :         PresenterCanvas::strokeTextureMappedPolyPolygon(
     369             :             const css::uno::Reference<css::rendering::XPolyPolygon2D >& xPolyPolygon,
     370             :             const css::rendering::ViewState& aViewState,
     371             :             const css::rendering::RenderState& aRenderState,
     372             :             const css::uno::Sequence<css::rendering::Texture>& aTextures,
     373             :             const css::uno::Reference<css::geometry::XMapping2D>& xMapping,
     374             :             const css::rendering::StrokeAttributes& aStrokeAttributes)
     375             :         throw (css::lang::IllegalArgumentException,
     376             :             css::rendering::VolatileContentDestroyedException,
     377             :             css::uno::RuntimeException, std::exception)
     378             : {
     379           0 :     ThrowIfDisposed();
     380           0 :     return mxSharedCanvas->strokeTextureMappedPolyPolygon(
     381             :         xPolyPolygon,
     382             :         MergeViewState(aViewState),
     383             :         aRenderState,
     384             :         aTextures,
     385             :         xMapping,
     386           0 :         aStrokeAttributes);
     387             : }
     388             : 
     389             : 
     390             : 
     391             : 
     392             : css::uno::Reference<css::rendering::XPolyPolygon2D> SAL_CALL
     393           0 :         PresenterCanvas::queryStrokeShapes(
     394             :             const css::uno::Reference<css::rendering::XPolyPolygon2D>& xPolyPolygon,
     395             :             const css::rendering::ViewState& aViewState,
     396             :             const css::rendering::RenderState& aRenderState,
     397             :             const css::rendering::StrokeAttributes& aStrokeAttributes)
     398             :         throw (css::lang::IllegalArgumentException, css::uno::RuntimeException, std::exception)
     399             : {
     400           0 :     ThrowIfDisposed();
     401           0 :     return mxSharedCanvas->queryStrokeShapes(
     402           0 :         xPolyPolygon, MergeViewState(aViewState), aRenderState, aStrokeAttributes);
     403             : }
     404             : 
     405             : 
     406             : 
     407             : 
     408             : css::uno::Reference<css::rendering::XCachedPrimitive> SAL_CALL
     409           0 :         PresenterCanvas::fillPolyPolygon(
     410             :             const css::uno::Reference<css::rendering::XPolyPolygon2D>& xPolyPolygon,
     411             :             const css::rendering::ViewState& aViewState,
     412             :             const css::rendering::RenderState& aRenderState)
     413             :         throw (css::lang::IllegalArgumentException,
     414             :             css::uno::RuntimeException, std::exception)
     415             : {
     416           0 :     ThrowIfDisposed();
     417           0 :     return mxSharedCanvas->fillPolyPolygon(
     418           0 :         xPolyPolygon, MergeViewState(aViewState), aRenderState);
     419             : }
     420             : 
     421             : 
     422             : 
     423             : 
     424             : css::uno::Reference<css::rendering::XCachedPrimitive> SAL_CALL
     425           0 :         PresenterCanvas::fillTexturedPolyPolygon(
     426             :             const css::uno::Reference<css::rendering::XPolyPolygon2D>& xPolyPolygon,
     427             :             const css::rendering::ViewState& aViewState,
     428             :             const css::rendering::RenderState& aRenderState,
     429             :             const css::uno::Sequence<css::rendering::Texture>& xTextures)
     430             :         throw (css::lang::IllegalArgumentException,
     431             :             css::rendering::VolatileContentDestroyedException,
     432             :             css::uno::RuntimeException, std::exception)
     433             : {
     434           0 :     ThrowIfDisposed();
     435           0 :     return mxSharedCanvas->fillTexturedPolyPolygon(
     436           0 :         xPolyPolygon, MergeViewState(aViewState), aRenderState, xTextures);
     437             : }
     438             : 
     439             : 
     440             : 
     441             : 
     442             : css::uno::Reference<css::rendering::XCachedPrimitive> SAL_CALL
     443           0 :         PresenterCanvas::fillTextureMappedPolyPolygon(
     444             :             const css::uno::Reference< css::rendering::XPolyPolygon2D >& xPolyPolygon,
     445             :             const css::rendering::ViewState& aViewState,
     446             :             const css::rendering::RenderState& aRenderState,
     447             :             const css::uno::Sequence< css::rendering::Texture >& xTextures,
     448             :             const css::uno::Reference< css::geometry::XMapping2D >& xMapping)
     449             :         throw (css::lang::IllegalArgumentException,
     450             :             css::rendering::VolatileContentDestroyedException,
     451             :             css::uno::RuntimeException, std::exception)
     452             : {
     453           0 :     ThrowIfDisposed();
     454           0 :     return mxSharedCanvas->fillTextureMappedPolyPolygon(
     455           0 :         xPolyPolygon, MergeViewState(aViewState), aRenderState, xTextures, xMapping);
     456             : }
     457             : 
     458             : 
     459             : 
     460             : 
     461             : css::uno::Reference<css::rendering::XCanvasFont> SAL_CALL
     462           0 :         PresenterCanvas::createFont(
     463             :             const css::rendering::FontRequest& aFontRequest,
     464             :             const css::uno::Sequence< css::beans::PropertyValue >& aExtraFontProperties,
     465             :             const css::geometry::Matrix2D& aFontMatrix)
     466             :         throw (css::lang::IllegalArgumentException,
     467             :             css::uno::RuntimeException, std::exception)
     468             : {
     469           0 :     ThrowIfDisposed();
     470           0 :     return mxSharedCanvas->createFont(
     471           0 :         aFontRequest, aExtraFontProperties, aFontMatrix);
     472             : }
     473             : 
     474             : 
     475             : 
     476             : 
     477             : css::uno::Sequence<css::rendering::FontInfo> SAL_CALL
     478           0 :         PresenterCanvas::queryAvailableFonts(
     479             :             const css::rendering::FontInfo& aFilter,
     480             :             const css::uno::Sequence< css::beans::PropertyValue >& aFontProperties)
     481             :         throw (css::lang::IllegalArgumentException, css::uno::RuntimeException, std::exception)
     482             : {
     483           0 :     ThrowIfDisposed();
     484           0 :     return mxSharedCanvas->queryAvailableFonts(aFilter, aFontProperties);
     485             : }
     486             : 
     487             : 
     488             : 
     489             : 
     490             : css::uno::Reference<css::rendering::XCachedPrimitive> SAL_CALL
     491           0 :         PresenterCanvas::drawText(
     492             :             const css::rendering::StringContext& aText,
     493             :             const css::uno::Reference< css::rendering::XCanvasFont >& xFont,
     494             :             const css::rendering::ViewState& aViewState,
     495             :             const css::rendering::RenderState& aRenderState,
     496             :             ::sal_Int8 nTextDirection)
     497             :         throw (css::lang::IllegalArgumentException, css::uno::RuntimeException, std::exception)
     498             : {
     499           0 :     ThrowIfDisposed();
     500           0 :     return mxSharedCanvas->drawText(
     501           0 :         aText, xFont, MergeViewState(aViewState), aRenderState, nTextDirection);
     502             : }
     503             : 
     504             : 
     505             : 
     506             : 
     507             : css::uno::Reference<css::rendering::XCachedPrimitive> SAL_CALL
     508           0 :         PresenterCanvas::drawTextLayout(
     509             :             const css::uno::Reference< css::rendering::XTextLayout >& xLayoutetText,
     510             :             const css::rendering::ViewState& aViewState,
     511             :             const css::rendering::RenderState& aRenderState)
     512             :         throw (css::lang::IllegalArgumentException, css::uno::RuntimeException, std::exception)
     513             : {
     514           0 :     ThrowIfDisposed();
     515           0 :     return mxSharedCanvas->drawTextLayout(
     516           0 :         xLayoutetText, MergeViewState(aViewState), aRenderState);
     517             : }
     518             : 
     519             : 
     520             : 
     521             : 
     522             : css::uno::Reference<css::rendering::XCachedPrimitive> SAL_CALL
     523           0 :         PresenterCanvas::drawBitmap(
     524             :             const css::uno::Reference< css::rendering::XBitmap >& xBitmap,
     525             :             const css::rendering::ViewState& aViewState,
     526             :             const css::rendering::RenderState& aRenderState)
     527             :         throw (css::lang::IllegalArgumentException,
     528             :             css::rendering::VolatileContentDestroyedException,
     529             :             css::uno::RuntimeException, std::exception)
     530             : {
     531           0 :     ThrowIfDisposed();
     532           0 :     return mxSharedCanvas->drawBitmap(
     533           0 :         xBitmap, MergeViewState(aViewState), aRenderState);
     534             : }
     535             : 
     536             : 
     537             : 
     538             : 
     539             : css::uno::Reference<css::rendering::XCachedPrimitive> SAL_CALL
     540           0 :         PresenterCanvas::drawBitmapModulated(
     541             :             const css::uno::Reference< css::rendering::XBitmap>& xBitmap,
     542             :             const css::rendering::ViewState& aViewState,
     543             :             const css::rendering::RenderState& aRenderState)
     544             :         throw (css::lang::IllegalArgumentException,
     545             :             css::rendering::VolatileContentDestroyedException,
     546             :             css::uno::RuntimeException, std::exception)
     547             : {
     548           0 :     ThrowIfDisposed();
     549           0 :     return mxSharedCanvas->drawBitmapModulated(
     550           0 :         xBitmap, MergeViewState(aViewState), aRenderState);
     551             : }
     552             : 
     553             : 
     554             : 
     555             : 
     556             : css::uno::Reference<css::rendering::XGraphicDevice> SAL_CALL
     557           0 :         PresenterCanvas::getDevice (void)
     558             :         throw (css::uno::RuntimeException, std::exception)
     559             : {
     560           0 :     ThrowIfDisposed();
     561           0 :     return mxSharedCanvas->getDevice();
     562             : }
     563             : 
     564             : 
     565             : 
     566             : 
     567             : //----- XSpriteCanvas ---------------------------------------------------------
     568             : 
     569             : Reference<rendering::XAnimatedSprite> SAL_CALL
     570           0 :     PresenterCanvas::createSpriteFromAnimation (
     571             :         const css::uno::Reference<css::rendering::XAnimation>& rAnimation)
     572             :     throw (css::lang::IllegalArgumentException, css::uno::RuntimeException, std::exception)
     573             : {
     574           0 :     ThrowIfDisposed();
     575             : 
     576           0 :     Reference<rendering::XSpriteCanvas> xSpriteCanvas (mxSharedCanvas, UNO_QUERY);
     577           0 :     if (xSpriteCanvas.is())
     578           0 :         return xSpriteCanvas->createSpriteFromAnimation(rAnimation);
     579             :     else
     580           0 :         return NULL;
     581             : }
     582             : 
     583             : 
     584             : 
     585             : 
     586             : Reference<rendering::XAnimatedSprite> SAL_CALL
     587           0 :     PresenterCanvas::createSpriteFromBitmaps (
     588             :         const css::uno::Sequence<
     589             :             css::uno::Reference< css::rendering::XBitmap > >& rAnimationBitmaps,
     590             :     ::sal_Int8 nInterpolationMode)
     591             :         throw (css::lang::IllegalArgumentException,
     592             :             css::rendering::VolatileContentDestroyedException,
     593             :             css::uno::RuntimeException, std::exception)
     594             : {
     595           0 :     ThrowIfDisposed();
     596             : 
     597           0 :     Reference<rendering::XSpriteCanvas> xSpriteCanvas (mxSharedCanvas, UNO_QUERY);
     598           0 :     if (xSpriteCanvas.is())
     599           0 :         return xSpriteCanvas->createSpriteFromBitmaps(rAnimationBitmaps, nInterpolationMode);
     600             :     else
     601           0 :         return NULL;
     602             : }
     603             : 
     604             : 
     605             : 
     606             : 
     607             : Reference<rendering::XCustomSprite> SAL_CALL
     608           0 :     PresenterCanvas::createCustomSprite (
     609             :         const css::geometry::RealSize2D& rSpriteSize)
     610             :     throw (css::lang::IllegalArgumentException, css::uno::RuntimeException, std::exception)
     611             : {
     612           0 :     ThrowIfDisposed();
     613             : 
     614           0 :     Reference<rendering::XSpriteCanvas> xSpriteCanvas (mxSharedCanvas, UNO_QUERY);
     615           0 :     if (xSpriteCanvas.is())
     616             :         return new PresenterCustomSprite(
     617             :             this,
     618           0 :             xSpriteCanvas->createCustomSprite(rSpriteSize),
     619             :             mxSharedWindow,
     620           0 :             rSpriteSize);
     621           0 :     else if (mxUpdateCanvas.is())
     622             :         return new PresenterCustomSprite(
     623             :             this,
     624           0 :             mxUpdateCanvas->createCustomSprite(rSpriteSize),
     625             :             mxUpdateWindow,
     626           0 :             rSpriteSize);
     627             :     else
     628           0 :         return NULL;
     629             : }
     630             : 
     631             : 
     632             : 
     633             : 
     634             : Reference<rendering::XSprite> SAL_CALL
     635           0 :     PresenterCanvas::createClonedSprite (
     636             :         const css::uno::Reference< css::rendering::XSprite >& rxOriginal)
     637             :     throw (css::lang::IllegalArgumentException, css::uno::RuntimeException, std::exception)
     638             : {
     639           0 :     ThrowIfDisposed();
     640             : 
     641           0 :     Reference<rendering::XSpriteCanvas> xSpriteCanvas (mxSharedCanvas, UNO_QUERY);
     642           0 :     if (xSpriteCanvas.is())
     643           0 :         return xSpriteCanvas->createClonedSprite(rxOriginal);
     644           0 :     if (mxUpdateCanvas.is())
     645           0 :         return mxUpdateCanvas->createClonedSprite(rxOriginal);
     646           0 :     return NULL;
     647             : }
     648             : 
     649             : 
     650             : 
     651             : 
     652           0 : sal_Bool SAL_CALL PresenterCanvas::updateScreen (sal_Bool bUpdateAll)
     653             :     throw (css::uno::RuntimeException, std::exception)
     654             : {
     655           0 :     ThrowIfDisposed();
     656             : 
     657           0 :     mbOffsetUpdatePending = true;
     658           0 :     if (mpUpdateRequester.get() != NULL)
     659             :     {
     660           0 :         mpUpdateRequester->RequestUpdate(bUpdateAll);
     661           0 :         return sal_True;
     662             :     }
     663             :     else
     664             :     {
     665           0 :         return sal_False;
     666             :     }
     667             : }
     668             : 
     669             : 
     670             : 
     671             : 
     672             : //----- XEventListener --------------------------------------------------------
     673             : 
     674           0 : void SAL_CALL PresenterCanvas::disposing (const css::lang::EventObject& rEvent)
     675             :     throw (css::uno::RuntimeException, std::exception)
     676             : {
     677           0 :     ThrowIfDisposed();
     678           0 :     if (rEvent.Source == mxWindow)
     679           0 :         mxWindow = NULL;
     680           0 : }
     681             : 
     682             : 
     683             : 
     684             : 
     685             : //----- XWindowListener -------------------------------------------------------
     686             : 
     687           0 : void SAL_CALL PresenterCanvas::windowResized (const css::awt::WindowEvent& rEvent)
     688             :         throw (css::uno::RuntimeException, std::exception)
     689             : {
     690             :     (void)rEvent;
     691           0 :     ThrowIfDisposed();
     692           0 :     mbOffsetUpdatePending = true;
     693           0 : }
     694             : 
     695             : 
     696             : 
     697             : 
     698           0 : void SAL_CALL PresenterCanvas::windowMoved (const css::awt::WindowEvent& rEvent)
     699             :     throw (css::uno::RuntimeException, std::exception)
     700             : {
     701             :     (void)rEvent;
     702           0 :     ThrowIfDisposed();
     703           0 :     mbOffsetUpdatePending = true;
     704           0 : }
     705             : 
     706             : 
     707             : 
     708             : 
     709           0 : void SAL_CALL PresenterCanvas::windowShown (const css::lang::EventObject& rEvent)
     710             :     throw (css::uno::RuntimeException, std::exception)
     711             : {
     712             :     (void)rEvent;
     713           0 :     ThrowIfDisposed();
     714           0 :     mbOffsetUpdatePending = true;
     715           0 : }
     716             : 
     717             : 
     718             : 
     719             : 
     720           0 : void SAL_CALL PresenterCanvas::windowHidden (const css::lang::EventObject& rEvent)
     721             :     throw (css::uno::RuntimeException, std::exception)
     722             : {
     723             :     (void)rEvent;
     724           0 :     ThrowIfDisposed();
     725           0 : }
     726             : 
     727             : 
     728             : 
     729             : 
     730             : //----- XBitmap ---------------------------------------------------------------
     731             : 
     732           0 : geometry::IntegerSize2D SAL_CALL PresenterCanvas::getSize (void)
     733             :     throw (RuntimeException, std::exception)
     734             : {
     735           0 :     ThrowIfDisposed();
     736             : 
     737           0 :     if (mxWindow.is())
     738             :     {
     739           0 :         const awt::Rectangle aWindowBox (mxWindow->getPosSize());
     740           0 :         return geometry::IntegerSize2D(aWindowBox.Width, aWindowBox.Height);
     741             :     }
     742             :     else
     743           0 :         return geometry::IntegerSize2D(0,0);
     744             : }
     745             : 
     746             : 
     747             : 
     748             : 
     749           0 : sal_Bool SAL_CALL PresenterCanvas::hasAlpha (void)
     750             :     throw (RuntimeException, std::exception)
     751             : {
     752           0 :     Reference<rendering::XBitmap> xBitmap (mxSharedCanvas, UNO_QUERY);
     753           0 :     if (xBitmap.is())
     754           0 :         return xBitmap->hasAlpha();
     755             :     else
     756           0 :         return sal_False;
     757             : }
     758             : 
     759             : 
     760             : 
     761             : 
     762           0 : Reference<rendering::XBitmap> SAL_CALL PresenterCanvas::getScaledBitmap(
     763             :     const css::geometry::RealSize2D& rNewSize,
     764             :     sal_Bool bFast)
     765             :     throw (css::uno::RuntimeException,
     766             :         css::lang::IllegalArgumentException,
     767             :         css::rendering::VolatileContentDestroyedException, std::exception)
     768             : {
     769             :     (void)rNewSize;
     770             :     (void)bFast;
     771             : 
     772           0 :     ThrowIfDisposed();
     773             : 
     774             :     // Not implemented.
     775             : 
     776           0 :     return NULL;
     777             : }
     778             : 
     779             : 
     780             : 
     781             : 
     782             : 
     783             : 
     784           0 : rendering::ViewState PresenterCanvas::MergeViewState (
     785             :     const rendering::ViewState& rViewState)
     786             : {
     787             :     // Make sure the offset is up-to-date.
     788           0 :     if (mbOffsetUpdatePending)
     789           0 :         maOffset = GetOffset(mxSharedWindow);
     790           0 :     return MergeViewState(rViewState, maOffset);
     791             : }
     792             : 
     793             : 
     794             : 
     795             : 
     796           0 : css::rendering::ViewState PresenterCanvas::MergeViewState (
     797             :     const css::rendering::ViewState& rViewState,
     798             :     const css::awt::Point& rOffset)
     799             : {
     800             :     // Early rejects.
     801           0 :     if ( ! mxSharedCanvas.is())
     802           0 :         return rViewState;
     803             : 
     804           0 :     Reference<rendering::XGraphicDevice> xDevice (mxSharedCanvas->getDevice());
     805           0 :     if ( ! xDevice.is())
     806           0 :         return rViewState;
     807             : 
     808             :     // Create a modifiable copy of the given view state.
     809           0 :     rendering::ViewState aViewState (rViewState);
     810             : 
     811             :     // Prepare the local clip rectangle.
     812           0 :     ::basegfx::B2DRectangle aWindowRange (GetClipRectangle(aViewState.AffineTransform, rOffset));
     813             : 
     814             :     // Adapt the offset of the view state.
     815           0 :     aViewState.AffineTransform.m02 += rOffset.X;
     816           0 :     aViewState.AffineTransform.m12 += rOffset.Y;
     817             : 
     818             :     // Adapt the clip polygon.
     819           0 :     if ( ! aViewState.Clip.is())
     820             :     {
     821             :         // Cancel out the later multiplication with the view state
     822             :         // transformation.
     823           0 :         aViewState.Clip = ::basegfx::unotools::xPolyPolygonFromB2DPolyPolygon(
     824             :             xDevice,
     825           0 :             ::basegfx::B2DPolyPolygon(::basegfx::tools::createPolygonFromRect(aWindowRange)));
     826             :     }
     827             :     else
     828             :     {
     829             :         // Have to compute the intersection of the given clipping polygon in
     830             :         // the view state and the local clip rectangle.
     831             : 
     832             :         // Clip the view state clipping polygon against the local clip rectangle.
     833             :         const ::basegfx::B2DPolyPolygon aClipPolygon (
     834             :             ::basegfx::unotools::b2DPolyPolygonFromXPolyPolygon2D(
     835           0 :                 aViewState.Clip));
     836             :         const ::basegfx::B2DPolyPolygon aClippedClipPolygon (
     837             :             ::basegfx::tools::clipPolyPolygonOnRange(
     838             :                 aClipPolygon,
     839             :                 aWindowRange,
     840             :                 true, /* bInside */
     841           0 :                 false /* bStroke */));
     842             : 
     843           0 :         aViewState.Clip = ::basegfx::unotools::xPolyPolygonFromB2DPolyPolygon(
     844             :             xDevice,
     845           0 :             aClippedClipPolygon);
     846             :     }
     847             : 
     848           0 :     return aViewState;
     849             : }
     850             : 
     851             : 
     852             : 
     853             : 
     854           0 : awt::Point PresenterCanvas::GetOffset (const Reference<awt::XWindow>& rxBaseWindow)
     855             : {
     856           0 :     mbOffsetUpdatePending = false;
     857           0 :     if (mxWindow.is() && rxBaseWindow.is())
     858             :     {
     859           0 :         ::Window* pWindow = VCLUnoHelper::GetWindow(mxWindow);
     860           0 :         ::Window* pSharedWindow = VCLUnoHelper::GetWindow(rxBaseWindow);
     861           0 :         if (pWindow!=NULL && pSharedWindow!=NULL)
     862             :         {
     863           0 :             Rectangle aBox = pWindow->GetWindowExtentsRelative(pSharedWindow);
     864             : 
     865             :             // Calculate offset of this canvas with respect to the shared
     866             :             // canvas.
     867           0 :             return awt::Point(aBox.Left(), aBox.Top());
     868             :         }
     869             :     }
     870             : 
     871           0 :     return awt::Point(0, 0);
     872             : }
     873             : 
     874             : 
     875             : 
     876             : 
     877           0 : ::basegfx::B2DRectangle PresenterCanvas::GetClipRectangle (
     878             :     const css::geometry::AffineMatrix2D& rViewTransform,
     879             :     const awt::Point& rOffset)
     880             : {
     881           0 :     ::basegfx::B2DRectangle aClipRectangle;
     882             : 
     883           0 :     ::Window* pWindow = VCLUnoHelper::GetWindow(mxWindow);
     884           0 :     if (pWindow == NULL)
     885           0 :         return ::basegfx::B2DRectangle();
     886             : 
     887           0 :     ::Window* pSharedWindow = VCLUnoHelper::GetWindow(mxSharedWindow);
     888           0 :     if (pSharedWindow == NULL)
     889           0 :         return ::basegfx::B2DRectangle();
     890             : 
     891             :     // Get the bounding box of the window and create a range in the
     892             :     // coordinate system of the child window.
     893           0 :     Rectangle aLocalClip;
     894           0 :     if (maClipRectangle.Width <= 0 || maClipRectangle.Height <= 0)
     895             :     {
     896             :         // No clip rectangle has been set via SetClip by the pane.
     897             :         // Use the window extents instead.
     898           0 :         aLocalClip = pWindow->GetWindowExtentsRelative(pSharedWindow);
     899             :     }
     900             :     else
     901             :     {
     902             :         // Use a previously given clip rectangle.
     903             :         aLocalClip = Rectangle(
     904             :             maClipRectangle.X + rOffset.X,
     905             :             maClipRectangle.Y + rOffset.Y,
     906           0 :             maClipRectangle.X + maClipRectangle.Width + rOffset.X,
     907           0 :             maClipRectangle.Y + maClipRectangle.Height + rOffset.Y);
     908             :     }
     909             : 
     910             :     // The local clip rectangle is used to clip the view state clipping
     911             :     // polygon.
     912             :     ::basegfx::B2DRectangle aWindowRectangle (
     913           0 :         aLocalClip.Left() - rOffset.X,
     914           0 :         aLocalClip.Top() - rOffset.Y,
     915           0 :         aLocalClip.Right() - rOffset.X + 1,
     916           0 :         aLocalClip.Bottom() - rOffset.Y + 1);
     917             : 
     918             :     // Calculate the inverted view state transformation to cancel out a
     919             :     // later transformation of the local clip polygon with the view state
     920             :     // transformation.
     921           0 :     ::basegfx::B2DHomMatrix aInvertedViewStateTransformation;
     922             :     ::basegfx::unotools::homMatrixFromAffineMatrix(
     923             :         aInvertedViewStateTransformation,
     924           0 :         rViewTransform);
     925           0 :     if (aInvertedViewStateTransformation.invert())
     926             :     {
     927             :         // Cancel out the later multiplication with the view state
     928             :         // transformation.
     929           0 :         aWindowRectangle.transform(aInvertedViewStateTransformation);
     930             :     }
     931             : 
     932           0 :     return aWindowRectangle;
     933             : }
     934             : 
     935             : 
     936             : 
     937           0 : Reference<rendering::XPolyPolygon2D> PresenterCanvas::UpdateSpriteClip (
     938             :     const Reference<rendering::XPolyPolygon2D>& rxOriginalClip,
     939             :     const geometry::RealPoint2D& rLocation,
     940             :     const geometry::RealSize2D& rSize)
     941             : {
     942             :     (void)rSize;
     943             : 
     944             :     // Check used resources and just return the original clip when not
     945             :     // every one of them is available.
     946           0 :     if ( ! mxWindow.is())
     947           0 :         return rxOriginalClip;
     948             : 
     949           0 :     Reference<rendering::XGraphicDevice> xDevice (mxSharedCanvas->getDevice());
     950           0 :     if ( ! xDevice.is())
     951           0 :         return rxOriginalClip;
     952             : 
     953             :     // Determine the bounds of the clip rectangle (the window border) in the
     954             :     // coordinate system of the sprite.
     955           0 :     const awt::Rectangle aWindowBox (mxWindow->getPosSize());
     956           0 :     const double nMinX (-rLocation.X);
     957           0 :     const double nMinY (-rLocation.Y);
     958           0 :     const double nMaxX (aWindowBox.Width-rLocation.X);
     959           0 :     const double nMaxY (aWindowBox.Height-rLocation.Y);
     960             : 
     961             :     // Create a clip polygon.
     962           0 :     Reference<rendering::XPolyPolygon2D> xPolygon;
     963           0 :     if (rxOriginalClip.is())
     964             :     {
     965             :         // Combine the original clip with the window clip.
     966             :         const ::basegfx::B2DPolyPolygon aOriginalClip (
     967           0 :             ::basegfx::unotools::b2DPolyPolygonFromXPolyPolygon2D(rxOriginalClip));
     968           0 :         ::basegfx::B2DRectangle aWindowRange (nMinX, nMinY, nMaxX, nMaxY);
     969             :         const ::basegfx::B2DPolyPolygon aClippedClipPolygon (
     970             :             ::basegfx::tools::clipPolyPolygonOnRange(
     971             :                 aOriginalClip,
     972             :                 aWindowRange,
     973             :                 true, /* bInside */
     974           0 :                 false /* bStroke */));
     975           0 :         xPolygon = ::basegfx::unotools::xPolyPolygonFromB2DPolyPolygon(
     976             :             xDevice,
     977           0 :             aClippedClipPolygon);
     978             :     }
     979             :     else
     980             :     {
     981             :         // Create a new clip polygon from the window clip rectangle.
     982           0 :         Sequence<Sequence<geometry::RealPoint2D> > aPoints (1);
     983           0 :         aPoints[0] = Sequence<geometry::RealPoint2D>(4);
     984           0 :         aPoints[0][0] = geometry::RealPoint2D(nMinX,nMinY);
     985           0 :         aPoints[0][1] = geometry::RealPoint2D(nMaxX,nMinY);
     986           0 :         aPoints[0][2] = geometry::RealPoint2D(nMaxX,nMaxY);
     987           0 :         aPoints[0][3] = geometry::RealPoint2D(nMinX,nMaxY);
     988             :         Reference<rendering::XLinePolyPolygon2D> xLinePolygon(
     989           0 :             xDevice->createCompatibleLinePolyPolygon(aPoints));
     990           0 :         if (xLinePolygon.is())
     991           0 :             xLinePolygon->setClosed(0, sal_True);
     992           0 :         xPolygon = Reference<rendering::XPolyPolygon2D>(xLinePolygon, UNO_QUERY);
     993             :     }
     994             : 
     995           0 :     return xPolygon;
     996             : }
     997             : 
     998             : 
     999             : 
    1000             : 
    1001           0 : void PresenterCanvas::ThrowIfDisposed (void)
    1002             :     throw (css::lang::DisposedException)
    1003             : {
    1004           0 :     if (rBHelper.bDisposed || rBHelper.bInDispose || ! mxSharedCanvas.is())
    1005             :     {
    1006             :         throw lang::DisposedException ("PresenterCanvas object has already been disposed",
    1007           0 :             static_cast<uno::XWeak*>(this));
    1008             :     }
    1009           0 : }
    1010             : 
    1011             : 
    1012             : 
    1013             : 
    1014             : //===== PresenterCustomSprite =================================================
    1015             : 
    1016             : 
    1017           0 : PresenterCustomSprite::PresenterCustomSprite (
    1018             :     const rtl::Reference<PresenterCanvas>& rpCanvas,
    1019             :     const Reference<rendering::XCustomSprite>& rxSprite,
    1020             :     const Reference<awt::XWindow>& rxBaseWindow,
    1021             :     const css::geometry::RealSize2D& rSpriteSize)
    1022             :     : PresenterCustomSpriteInterfaceBase(m_aMutex),
    1023             :       mpCanvas(rpCanvas),
    1024             :       mxSprite(rxSprite),
    1025             :       mxBaseWindow(rxBaseWindow),
    1026             :       maPosition(0,0),
    1027           0 :       maSpriteSize(rSpriteSize)
    1028             : {
    1029           0 : }
    1030             : 
    1031             : 
    1032             : 
    1033             : 
    1034           0 : PresenterCustomSprite::~PresenterCustomSprite (void)
    1035             : {
    1036           0 : }
    1037             : 
    1038             : 
    1039             : 
    1040             : 
    1041           0 : void SAL_CALL PresenterCustomSprite::disposing (void)
    1042             :     throw (RuntimeException)
    1043             : {
    1044           0 :     Reference<XComponent> xComponent (mxSprite, UNO_QUERY);
    1045           0 :     mxSprite = NULL;
    1046           0 :     if (xComponent.is())
    1047           0 :         xComponent->dispose();
    1048           0 :     mpCanvas = rtl::Reference<PresenterCanvas>();
    1049           0 : }
    1050             : 
    1051             : 
    1052             : 
    1053             : 
    1054             : //----- XSprite ---------------------------------------------------------------
    1055             : 
    1056           0 : void SAL_CALL PresenterCustomSprite::setAlpha (const double nAlpha)
    1057             :     throw (lang::IllegalArgumentException,RuntimeException, std::exception)
    1058             : {
    1059           0 :     ThrowIfDisposed();
    1060           0 :     mxSprite->setAlpha(nAlpha);
    1061           0 : }
    1062             : 
    1063             : 
    1064             : 
    1065             : 
    1066           0 : void SAL_CALL PresenterCustomSprite::move (
    1067             :     const geometry::RealPoint2D& rNewPos,
    1068             :     const rendering::ViewState& rViewState,
    1069             :     const rendering::RenderState& rRenderState)
    1070             :     throw (lang::IllegalArgumentException,RuntimeException, std::exception)
    1071             : {
    1072           0 :     ThrowIfDisposed();
    1073           0 :     maPosition = rNewPos;
    1074           0 :     mxSprite->move(
    1075             :         rNewPos,
    1076           0 :         mpCanvas->MergeViewState(rViewState, mpCanvas->GetOffset(mxBaseWindow)),
    1077           0 :         rRenderState);
    1078             :     // Clip sprite against window bounds.  This call is necessary because
    1079             :     // sprite clipping is done in the corrdinate system of the sprite.
    1080             :     // Therefore, after each change of the sprites location the window
    1081             :     // bounds have to be transformed into the sprites coordinate system.
    1082           0 :     clip(NULL);
    1083           0 : }
    1084             : 
    1085             : 
    1086             : 
    1087             : 
    1088           0 : void SAL_CALL PresenterCustomSprite::transform (const geometry::AffineMatrix2D& rTransformation)
    1089             :     throw (lang::IllegalArgumentException,RuntimeException, std::exception)
    1090             : {
    1091           0 :     ThrowIfDisposed();
    1092           0 :     mxSprite->transform(rTransformation);
    1093           0 : }
    1094             : 
    1095             : 
    1096             : 
    1097             : 
    1098           0 : void SAL_CALL PresenterCustomSprite::clip (const Reference<rendering::XPolyPolygon2D>& rxClip)
    1099             :     throw (RuntimeException, std::exception)
    1100             : {
    1101           0 :     ThrowIfDisposed();
    1102             :     // The clip region is expected in the coordinate system of the sprite.
    1103             :     // UpdateSpriteClip() integrates the window bounds, transformed into the
    1104             :     // sprites coordinate system, with the given clip.
    1105           0 :     mxSprite->clip(mpCanvas->UpdateSpriteClip(rxClip, maPosition, maSpriteSize));
    1106           0 : }
    1107             : 
    1108             : 
    1109             : 
    1110             : 
    1111           0 : void SAL_CALL PresenterCustomSprite::setPriority (const double nPriority)
    1112             :     throw (RuntimeException, std::exception)
    1113             : {
    1114           0 :     ThrowIfDisposed();
    1115           0 :     mxSprite->setPriority(nPriority);
    1116           0 : }
    1117             : 
    1118             : 
    1119             : 
    1120           0 : void SAL_CALL PresenterCustomSprite::show (void)
    1121             :     throw (RuntimeException, std::exception)
    1122             : {
    1123           0 :     ThrowIfDisposed();
    1124           0 :     mxSprite->show();
    1125           0 : }
    1126             : 
    1127             : 
    1128             : 
    1129             : 
    1130           0 : void SAL_CALL PresenterCustomSprite::hide (void)
    1131             :     throw (RuntimeException, std::exception)
    1132             : {
    1133           0 :     ThrowIfDisposed();
    1134           0 :     mxSprite->hide();
    1135           0 : }
    1136             : 
    1137             : 
    1138             : 
    1139             : 
    1140             : //----- XCustomSprite ---------------------------------------------------------
    1141             : 
    1142           0 : Reference<rendering::XCanvas> PresenterCustomSprite::getContentCanvas (void)
    1143             :     throw (RuntimeException, std::exception)
    1144             : {
    1145           0 :     ThrowIfDisposed();
    1146           0 :     return mxSprite->getContentCanvas();
    1147             : }
    1148             : 
    1149             : 
    1150             : 
    1151             : 
    1152             : 
    1153             : 
    1154           0 : void PresenterCustomSprite::ThrowIfDisposed (void)
    1155             :     throw (css::lang::DisposedException)
    1156             : {
    1157           0 :     if (rBHelper.bDisposed || rBHelper.bInDispose || ! mxSprite.is())
    1158             :     {
    1159             :         throw lang::DisposedException ("PresenterCustomSprite object has already been disposed",
    1160           0 :             static_cast<uno::XWeak*>(this));
    1161             :     }
    1162           0 : }
    1163             : 
    1164             : 
    1165             : 
    1166             : 
    1167             : } } // end of namespace ::sd::presenter
    1168             : 
    1169             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10