LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/sd/source/ui/presenter - PresenterCanvas.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 3 341 0.9 %
Date: 2013-07-09 Functions: 3 64 4.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           0 : Reference<XInterface> SAL_CALL PresenterCanvas_createInstance (
      45             :     const Reference<XComponentContext>& rxContext)
      46             : {
      47             :     (void)rxContext;
      48           0 :     return Reference<XInterface>(static_cast<XWeak*>(new PresenterCanvas()));
      49             : }
      50             : 
      51             : 
      52             : 
      53             : 
      54          10 : OUString PresenterCanvas_getImplementationName (void) throw(RuntimeException)
      55             : {
      56          10 :     return OUString("com.sun.star.comp.Draw.PresenterCanvasFactory");
      57             : }
      58             : 
      59             : 
      60             : 
      61             : 
      62           0 : Sequence<OUString> SAL_CALL PresenterCanvas_getSupportedServiceNames (void)
      63             :     throw (RuntimeException)
      64             : {
      65           0 :     static const OUString sServiceName("com.sun.star.rendering.Canvas");
      66           0 :     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);
      95             : 
      96             :     // XSprite
      97             : 
      98             :     virtual void SAL_CALL setAlpha (double nAlpha)
      99             :         throw (lang::IllegalArgumentException,RuntimeException);
     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);
     105             : 
     106             :     virtual void SAL_CALL transform (const geometry::AffineMatrix2D& rTransformation)
     107             :         throw (lang::IllegalArgumentException,RuntimeException);
     108             : 
     109             :     virtual void SAL_CALL clip (const Reference<rendering::XPolyPolygon2D>& rClip)
     110             :         throw (RuntimeException);
     111             : 
     112             :     virtual void SAL_CALL setPriority (double nPriority)
     113             :         throw (RuntimeException);
     114             : 
     115             :     virtual void SAL_CALL show (void)
     116             :         throw (RuntimeException);
     117             : 
     118             :     virtual void SAL_CALL hide (void)
     119             :         throw (RuntimeException);
     120             : 
     121             : 
     122             :     // XCustomSprite
     123             : 
     124             :     virtual Reference<rendering::XCanvas> SAL_CALL getContentCanvas (void)
     125             :         throw (RuntimeException);
     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           0 : PresenterCanvas::PresenterCanvas (void)
     145             :     : PresenterCanvasInterfaceBase(m_aMutex),
     146             :       mxUpdateCanvas(),
     147             :       mxSharedCanvas(),
     148             :       mxSharedWindow(),
     149             :       mxWindow(),
     150             :       maOffset(),
     151             :       mpUpdateRequester(),
     152             :       maClipRectangle(),
     153           0 :       mbOffsetUpdatePending(true)
     154             : {
     155           0 : }
     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           0 : PresenterCanvas::~PresenterCanvas (void)
     188             : {
     189           0 : }
     190             : 
     191             : 
     192             : 
     193             : 
     194           0 : void SAL_CALL PresenterCanvas::disposing (void)
     195             :     throw (css::uno::RuntimeException)
     196             : {
     197           0 :     if (mxWindow.is())
     198           0 :         mxWindow->removeWindowListener(this);
     199           0 : }
     200             : 
     201             : 
     202             : 
     203             : 
     204             : //----- XInitialization -------------------------------------------------------
     205             : 
     206           0 : void SAL_CALL PresenterCanvas::initialize (
     207             :     const Sequence<Any>& rArguments)
     208             :     throw(Exception, RuntimeException)
     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)
     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)
     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)
     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)
     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)
     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)
     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)
     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)
     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)
     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)
     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)
     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)
     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)
     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)
     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)
     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)
     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)
     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)
     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)
     559             : {
     560           0 :     ThrowIfDisposed();
     561           0 :     return mxSharedCanvas->getDevice();
     562             : }
     563             : 
     564             : 
     565             : 
     566             : 
     567             : //----- XBitmapCanvas ---------------------------------------------------------
     568             : 
     569           0 : void SAL_CALL PresenterCanvas::copyRect(
     570             :     const css::uno::Reference<css::rendering::XBitmapCanvas>& rxSourceCanvas,
     571             :     const css::geometry::RealRectangle2D& rSourceRect,
     572             :     const css::rendering::ViewState& rSourceViewState,
     573             :     const css::rendering::RenderState& rSourceRenderState,
     574             :     const css::geometry::RealRectangle2D& rDestRect,
     575             :     const css::rendering::ViewState& rDestViewState,
     576             :     const css::rendering::RenderState& rDestRenderState)
     577             :     throw (css::lang::IllegalArgumentException,
     578             :         css::rendering::VolatileContentDestroyedException,
     579             :         css::uno::RuntimeException)
     580             : {
     581           0 :     ThrowIfDisposed();
     582             : 
     583           0 :     Reference<rendering::XBitmapCanvas> xBitmapCanvas (mxSharedCanvas, UNO_QUERY);
     584           0 :     if (xBitmapCanvas.is())
     585             :     {
     586           0 :         rendering::ViewState aSourceViewState (rSourceViewState);
     587           0 :         if (rxSourceCanvas == Reference<rendering::XCanvas>(this))
     588           0 :             aSourceViewState = MergeViewState(aSourceViewState);
     589           0 :         xBitmapCanvas->copyRect(
     590             :             rxSourceCanvas, rSourceRect, aSourceViewState, rSourceRenderState,
     591           0 :             rDestRect, MergeViewState(rDestViewState), rDestRenderState);
     592           0 :     }
     593           0 : }
     594             : 
     595             : 
     596             : 
     597             : 
     598             : //----- XSpriteCanvas ---------------------------------------------------------
     599             : 
     600             : Reference<rendering::XAnimatedSprite> SAL_CALL
     601           0 :     PresenterCanvas::createSpriteFromAnimation (
     602             :         const css::uno::Reference<css::rendering::XAnimation>& rAnimation)
     603             :     throw (css::lang::IllegalArgumentException, css::uno::RuntimeException)
     604             : {
     605           0 :     ThrowIfDisposed();
     606             : 
     607           0 :     Reference<rendering::XSpriteCanvas> xSpriteCanvas (mxSharedCanvas, UNO_QUERY);
     608           0 :     if (xSpriteCanvas.is())
     609           0 :         return xSpriteCanvas->createSpriteFromAnimation(rAnimation);
     610             :     else
     611           0 :         return NULL;
     612             : }
     613             : 
     614             : 
     615             : 
     616             : 
     617             : Reference<rendering::XAnimatedSprite> SAL_CALL
     618           0 :     PresenterCanvas::createSpriteFromBitmaps (
     619             :         const css::uno::Sequence<
     620             :             css::uno::Reference< css::rendering::XBitmap > >& rAnimationBitmaps,
     621             :     ::sal_Int8 nInterpolationMode)
     622             :         throw (css::lang::IllegalArgumentException,
     623             :             css::rendering::VolatileContentDestroyedException,
     624             :             css::uno::RuntimeException)
     625             : {
     626           0 :     ThrowIfDisposed();
     627             : 
     628           0 :     Reference<rendering::XSpriteCanvas> xSpriteCanvas (mxSharedCanvas, UNO_QUERY);
     629           0 :     if (xSpriteCanvas.is())
     630           0 :         return xSpriteCanvas->createSpriteFromBitmaps(rAnimationBitmaps, nInterpolationMode);
     631             :     else
     632           0 :         return NULL;
     633             : }
     634             : 
     635             : 
     636             : 
     637             : 
     638             : Reference<rendering::XCustomSprite> SAL_CALL
     639           0 :     PresenterCanvas::createCustomSprite (
     640             :         const css::geometry::RealSize2D& rSpriteSize)
     641             :     throw (css::lang::IllegalArgumentException, css::uno::RuntimeException)
     642             : {
     643           0 :     ThrowIfDisposed();
     644             : 
     645           0 :     Reference<rendering::XSpriteCanvas> xSpriteCanvas (mxSharedCanvas, UNO_QUERY);
     646           0 :     if (xSpriteCanvas.is())
     647             :         return new PresenterCustomSprite(
     648             :             this,
     649           0 :             xSpriteCanvas->createCustomSprite(rSpriteSize),
     650             :             mxSharedWindow,
     651           0 :             rSpriteSize);
     652           0 :     else if (mxUpdateCanvas.is())
     653             :         return new PresenterCustomSprite(
     654             :             this,
     655           0 :             mxUpdateCanvas->createCustomSprite(rSpriteSize),
     656             :             mxUpdateWindow,
     657           0 :             rSpriteSize);
     658             :     else
     659           0 :         return NULL;
     660             : }
     661             : 
     662             : 
     663             : 
     664             : 
     665             : Reference<rendering::XSprite> SAL_CALL
     666           0 :     PresenterCanvas::createClonedSprite (
     667             :         const css::uno::Reference< css::rendering::XSprite >& rxOriginal)
     668             :     throw (css::lang::IllegalArgumentException, css::uno::RuntimeException)
     669             : {
     670           0 :     ThrowIfDisposed();
     671             : 
     672           0 :     Reference<rendering::XSpriteCanvas> xSpriteCanvas (mxSharedCanvas, UNO_QUERY);
     673           0 :     if (xSpriteCanvas.is())
     674           0 :         return xSpriteCanvas->createClonedSprite(rxOriginal);
     675           0 :     if (mxUpdateCanvas.is())
     676           0 :         return mxUpdateCanvas->createClonedSprite(rxOriginal);
     677           0 :     return NULL;
     678             : }
     679             : 
     680             : 
     681             : 
     682             : 
     683           0 : ::sal_Bool SAL_CALL PresenterCanvas::updateScreen (::sal_Bool bUpdateAll)
     684             :     throw (css::uno::RuntimeException)
     685             : {
     686           0 :     ThrowIfDisposed();
     687             : 
     688           0 :     mbOffsetUpdatePending = true;
     689           0 :     if (mpUpdateRequester.get() != NULL)
     690             :     {
     691           0 :         mpUpdateRequester->RequestUpdate(bUpdateAll);
     692           0 :         return sal_True;
     693             :     }
     694             :     else
     695             :     {
     696           0 :         return sal_False;
     697             :     }
     698             : }
     699             : 
     700             : 
     701             : 
     702             : 
     703             : //----- XEventListener --------------------------------------------------------
     704             : 
     705           0 : void SAL_CALL PresenterCanvas::disposing (const css::lang::EventObject& rEvent)
     706             :     throw (css::uno::RuntimeException)
     707             : {
     708           0 :     ThrowIfDisposed();
     709           0 :     if (rEvent.Source == mxWindow)
     710           0 :         mxWindow = NULL;
     711           0 : }
     712             : 
     713             : 
     714             : 
     715             : 
     716             : //----- XWindowListener -------------------------------------------------------
     717             : 
     718           0 : void SAL_CALL PresenterCanvas::windowResized (const css::awt::WindowEvent& rEvent)
     719             :         throw (css::uno::RuntimeException)
     720             : {
     721             :     (void)rEvent;
     722           0 :     ThrowIfDisposed();
     723           0 :     mbOffsetUpdatePending = true;
     724           0 : }
     725             : 
     726             : 
     727             : 
     728             : 
     729           0 : void SAL_CALL PresenterCanvas::windowMoved (const css::awt::WindowEvent& rEvent)
     730             :     throw (css::uno::RuntimeException)
     731             : {
     732             :     (void)rEvent;
     733           0 :     ThrowIfDisposed();
     734           0 :     mbOffsetUpdatePending = true;
     735           0 : }
     736             : 
     737             : 
     738             : 
     739             : 
     740           0 : void SAL_CALL PresenterCanvas::windowShown (const css::lang::EventObject& rEvent)
     741             :     throw (css::uno::RuntimeException)
     742             : {
     743             :     (void)rEvent;
     744           0 :     ThrowIfDisposed();
     745           0 :     mbOffsetUpdatePending = true;
     746           0 : }
     747             : 
     748             : 
     749             : 
     750             : 
     751           0 : void SAL_CALL PresenterCanvas::windowHidden (const css::lang::EventObject& rEvent)
     752             :     throw (css::uno::RuntimeException)
     753             : {
     754             :     (void)rEvent;
     755           0 :     ThrowIfDisposed();
     756           0 : }
     757             : 
     758             : 
     759             : 
     760             : 
     761             : //----- XBitmap ---------------------------------------------------------------
     762             : 
     763           0 : geometry::IntegerSize2D SAL_CALL PresenterCanvas::getSize (void)
     764             :     throw (RuntimeException)
     765             : {
     766           0 :     ThrowIfDisposed();
     767             : 
     768           0 :     if (mxWindow.is())
     769             :     {
     770           0 :         const awt::Rectangle aWindowBox (mxWindow->getPosSize());
     771           0 :         return geometry::IntegerSize2D(aWindowBox.Width, aWindowBox.Height);
     772             :     }
     773             :     else
     774           0 :         return geometry::IntegerSize2D(0,0);
     775             : }
     776             : 
     777             : 
     778             : 
     779             : 
     780           0 : sal_Bool SAL_CALL PresenterCanvas::hasAlpha (void)
     781             :     throw (RuntimeException)
     782             : {
     783           0 :     Reference<rendering::XBitmap> xBitmap (mxSharedCanvas, UNO_QUERY);
     784           0 :     if (xBitmap.is())
     785           0 :         return xBitmap->hasAlpha();
     786             :     else
     787           0 :         return sal_False;
     788             : }
     789             : 
     790             : 
     791             : 
     792             : 
     793           0 : Reference<rendering::XBitmapCanvas> SAL_CALL PresenterCanvas::queryBitmapCanvas (void)
     794             :     throw (RuntimeException)
     795             : {
     796           0 :     ThrowIfDisposed();
     797             : 
     798           0 :     return this;
     799             : }
     800             : 
     801             : 
     802             : 
     803             : 
     804           0 : Reference<rendering::XBitmap> SAL_CALL PresenterCanvas::getScaledBitmap(
     805             :     const css::geometry::RealSize2D& rNewSize,
     806             :     sal_Bool bFast)
     807             :     throw (css::uno::RuntimeException,
     808             :         css::lang::IllegalArgumentException,
     809             :         css::rendering::VolatileContentDestroyedException)
     810             : {
     811             :     (void)rNewSize;
     812             :     (void)bFast;
     813             : 
     814           0 :     ThrowIfDisposed();
     815             : 
     816             :     // Not implemented.
     817             : 
     818           0 :     return NULL;
     819             : }
     820             : 
     821             : 
     822             : 
     823             : 
     824             : //-----------------------------------------------------------------------------
     825             : 
     826           0 : rendering::ViewState PresenterCanvas::MergeViewState (
     827             :     const rendering::ViewState& rViewState)
     828             : {
     829             :     // Make sure the offset is up-to-date.
     830           0 :     if (mbOffsetUpdatePending)
     831           0 :         maOffset = GetOffset(mxSharedWindow);
     832           0 :     return MergeViewState(rViewState, maOffset);
     833             : }
     834             : 
     835             : 
     836             : 
     837             : 
     838           0 : css::rendering::ViewState PresenterCanvas::MergeViewState (
     839             :     const css::rendering::ViewState& rViewState,
     840             :     const css::awt::Point& rOffset)
     841             : {
     842             :     // Early rejects.
     843           0 :     if ( ! mxSharedCanvas.is())
     844           0 :         return rViewState;
     845             : 
     846           0 :     Reference<rendering::XGraphicDevice> xDevice (mxSharedCanvas->getDevice());
     847           0 :     if ( ! xDevice.is())
     848           0 :         return rViewState;
     849             : 
     850             :     // Create a modifiable copy of the given view state.
     851           0 :     rendering::ViewState aViewState (rViewState);
     852             : 
     853             :     // Prepare the local clip rectangle.
     854           0 :     ::basegfx::B2DRectangle aWindowRange (GetClipRectangle(aViewState.AffineTransform, rOffset));
     855             : 
     856             :     // Adapt the offset of the view state.
     857           0 :     aViewState.AffineTransform.m02 += rOffset.X;
     858           0 :     aViewState.AffineTransform.m12 += rOffset.Y;
     859             : 
     860             :     // Adapt the clip polygon.
     861           0 :     if ( ! aViewState.Clip.is())
     862             :     {
     863             :         // Cancel out the later multiplication with the view state
     864             :         // transformation.
     865           0 :         aViewState.Clip = ::basegfx::unotools::xPolyPolygonFromB2DPolyPolygon(
     866             :             xDevice,
     867           0 :             ::basegfx::B2DPolyPolygon(::basegfx::tools::createPolygonFromRect(aWindowRange)));
     868             :     }
     869             :     else
     870             :     {
     871             :         // Have to compute the intersection of the given clipping polygon in
     872             :         // the view state and the local clip rectangle.
     873             : 
     874             :         // Clip the view state clipping polygon against the local clip rectangle.
     875             :         const ::basegfx::B2DPolyPolygon aClipPolygon (
     876             :             ::basegfx::unotools::b2DPolyPolygonFromXPolyPolygon2D(
     877           0 :                 aViewState.Clip));
     878             :         const ::basegfx::B2DPolyPolygon aClippedClipPolygon (
     879             :             ::basegfx::tools::clipPolyPolygonOnRange(
     880             :                 aClipPolygon,
     881             :                 aWindowRange,
     882             :                 true, /* bInside */
     883           0 :                 false /* bStroke */));
     884             : 
     885           0 :         aViewState.Clip = ::basegfx::unotools::xPolyPolygonFromB2DPolyPolygon(
     886             :             xDevice,
     887           0 :             aClippedClipPolygon);
     888             :     }
     889             : 
     890           0 :     return aViewState;
     891             : }
     892             : 
     893             : 
     894             : 
     895             : 
     896           0 : awt::Point PresenterCanvas::GetOffset (const Reference<awt::XWindow>& rxBaseWindow)
     897             : {
     898           0 :     mbOffsetUpdatePending = false;
     899           0 :     if (mxWindow.is() && rxBaseWindow.is())
     900             :     {
     901           0 :         ::Window* pWindow = VCLUnoHelper::GetWindow(mxWindow);
     902           0 :         ::Window* pSharedWindow = VCLUnoHelper::GetWindow(rxBaseWindow);
     903           0 :         if (pWindow!=NULL && pSharedWindow!=NULL)
     904             :         {
     905           0 :             Rectangle aBox = pWindow->GetWindowExtentsRelative(pSharedWindow);
     906             : 
     907             :             // Calculate offset of this canvas with respect to the shared
     908             :             // canvas.
     909           0 :             return awt::Point(aBox.Left(), aBox.Top());
     910             :         }
     911             :     }
     912             : 
     913           0 :     return awt::Point(0, 0);
     914             : }
     915             : 
     916             : 
     917             : 
     918             : 
     919           0 : ::basegfx::B2DRectangle PresenterCanvas::GetClipRectangle (
     920             :     const css::geometry::AffineMatrix2D& rViewTransform,
     921             :     const awt::Point& rOffset)
     922             : {
     923           0 :     ::basegfx::B2DRectangle aClipRectangle;
     924             : 
     925           0 :     ::Window* pWindow = VCLUnoHelper::GetWindow(mxWindow);
     926           0 :     if (pWindow == NULL)
     927           0 :         return ::basegfx::B2DRectangle();
     928             : 
     929           0 :     ::Window* pSharedWindow = VCLUnoHelper::GetWindow(mxSharedWindow);
     930           0 :     if (pSharedWindow == NULL)
     931           0 :         return ::basegfx::B2DRectangle();
     932             : 
     933             :     // Get the bounding box of the window and create a range in the
     934             :     // coordinate system of the child window.
     935           0 :     Rectangle aLocalClip;
     936           0 :     if (maClipRectangle.Width <= 0 || maClipRectangle.Height <= 0)
     937             :     {
     938             :         // No clip rectangle has been set via SetClip by the pane.
     939             :         // Use the window extents instead.
     940           0 :         aLocalClip = pWindow->GetWindowExtentsRelative(pSharedWindow);
     941             :     }
     942             :     else
     943             :     {
     944             :         // Use a previously given clip rectangle.
     945             :         aLocalClip = Rectangle(
     946             :             maClipRectangle.X + rOffset.X,
     947             :             maClipRectangle.Y + rOffset.Y,
     948           0 :             maClipRectangle.X + maClipRectangle.Width + rOffset.X,
     949           0 :             maClipRectangle.Y + maClipRectangle.Height + rOffset.Y);
     950             :     }
     951             : 
     952             :     // The local clip rectangle is used to clip the view state clipping
     953             :     // polygon.
     954             :     ::basegfx::B2DRectangle aWindowRectangle (
     955           0 :         aLocalClip.Left() - rOffset.X,
     956           0 :         aLocalClip.Top() - rOffset.Y,
     957           0 :         aLocalClip.Right() - rOffset.X + 1,
     958           0 :         aLocalClip.Bottom() - rOffset.Y + 1);
     959             : 
     960             :     // Calculate the inverted view state transformation to cancel out a
     961             :     // later transformation of the local clip polygon with the view state
     962             :     // transformation.
     963           0 :     ::basegfx::B2DHomMatrix aInvertedViewStateTransformation;
     964             :     ::basegfx::unotools::homMatrixFromAffineMatrix(
     965             :         aInvertedViewStateTransformation,
     966           0 :         rViewTransform);
     967           0 :     if (aInvertedViewStateTransformation.invert())
     968             :     {
     969             :         // Cancel out the later multiplication with the view state
     970             :         // transformation.
     971           0 :         aWindowRectangle.transform(aInvertedViewStateTransformation);
     972             :     }
     973             : 
     974           0 :     return aWindowRectangle;
     975             : }
     976             : 
     977             : 
     978             : 
     979           0 : Reference<rendering::XPolyPolygon2D> PresenterCanvas::UpdateSpriteClip (
     980             :     const Reference<rendering::XPolyPolygon2D>& rxOriginalClip,
     981             :     const geometry::RealPoint2D& rLocation,
     982             :     const geometry::RealSize2D& rSize)
     983             : {
     984             :     (void)rSize;
     985             : 
     986             :     // Check used resources and just return the original clip when not
     987             :     // every one of them is available.
     988           0 :     if ( ! mxWindow.is())
     989           0 :         return rxOriginalClip;
     990             : 
     991           0 :     Reference<rendering::XGraphicDevice> xDevice (mxSharedCanvas->getDevice());
     992           0 :     if ( ! xDevice.is())
     993           0 :         return rxOriginalClip;
     994             : 
     995             :     // Determine the bounds of the clip rectangle (the window border) in the
     996             :     // coordinate system of the sprite.
     997           0 :     const awt::Rectangle aWindowBox (mxWindow->getPosSize());
     998           0 :     const double nMinX (-rLocation.X);
     999           0 :     const double nMinY (-rLocation.Y);
    1000           0 :     const double nMaxX (aWindowBox.Width-rLocation.X);
    1001           0 :     const double nMaxY (aWindowBox.Height-rLocation.Y);
    1002             : 
    1003             :     // Create a clip polygon.
    1004           0 :     Reference<rendering::XPolyPolygon2D> xPolygon;
    1005           0 :     if (rxOriginalClip.is())
    1006             :     {
    1007             :         // Combine the original clip with the window clip.
    1008             :         const ::basegfx::B2DPolyPolygon aOriginalClip (
    1009           0 :             ::basegfx::unotools::b2DPolyPolygonFromXPolyPolygon2D(rxOriginalClip));
    1010           0 :         ::basegfx::B2DRectangle aWindowRange (nMinX, nMinY, nMaxX, nMaxY);
    1011             :         const ::basegfx::B2DPolyPolygon aClippedClipPolygon (
    1012             :             ::basegfx::tools::clipPolyPolygonOnRange(
    1013             :                 aOriginalClip,
    1014             :                 aWindowRange,
    1015             :                 true, /* bInside */
    1016           0 :                 false /* bStroke */));
    1017           0 :         xPolygon = ::basegfx::unotools::xPolyPolygonFromB2DPolyPolygon(
    1018             :             xDevice,
    1019           0 :             aClippedClipPolygon);
    1020             :     }
    1021             :     else
    1022             :     {
    1023             :         // Create a new clip polygon from the window clip rectangle.
    1024           0 :         Sequence<Sequence<geometry::RealPoint2D> > aPoints (1);
    1025           0 :         aPoints[0] = Sequence<geometry::RealPoint2D>(4);
    1026           0 :         aPoints[0][0] = geometry::RealPoint2D(nMinX,nMinY);
    1027           0 :         aPoints[0][1] = geometry::RealPoint2D(nMaxX,nMinY);
    1028           0 :         aPoints[0][2] = geometry::RealPoint2D(nMaxX,nMaxY);
    1029           0 :         aPoints[0][3] = geometry::RealPoint2D(nMinX,nMaxY);
    1030             :         Reference<rendering::XLinePolyPolygon2D> xLinePolygon(
    1031           0 :             xDevice->createCompatibleLinePolyPolygon(aPoints));
    1032           0 :         if (xLinePolygon.is())
    1033           0 :             xLinePolygon->setClosed(0, sal_True);
    1034           0 :         xPolygon = Reference<rendering::XPolyPolygon2D>(xLinePolygon, UNO_QUERY);
    1035             :     }
    1036             : 
    1037           0 :     return xPolygon;
    1038             : }
    1039             : 
    1040             : 
    1041             : 
    1042             : 
    1043           0 : void PresenterCanvas::ThrowIfDisposed (void)
    1044             :     throw (css::lang::DisposedException)
    1045             : {
    1046           0 :     if (rBHelper.bDisposed || rBHelper.bInDispose || ! mxSharedCanvas.is())
    1047             :     {
    1048             :         throw lang::DisposedException ("PresenterCanvas object has already been disposed",
    1049           0 :             static_cast<uno::XWeak*>(this));
    1050             :     }
    1051           0 : }
    1052             : 
    1053             : 
    1054             : 
    1055             : 
    1056             : //===== PresenterCustomSprite =================================================
    1057             : 
    1058             : 
    1059           0 : PresenterCustomSprite::PresenterCustomSprite (
    1060             :     const rtl::Reference<PresenterCanvas>& rpCanvas,
    1061             :     const Reference<rendering::XCustomSprite>& rxSprite,
    1062             :     const Reference<awt::XWindow>& rxBaseWindow,
    1063             :     const css::geometry::RealSize2D& rSpriteSize)
    1064             :     : PresenterCustomSpriteInterfaceBase(m_aMutex),
    1065             :       mpCanvas(rpCanvas),
    1066             :       mxSprite(rxSprite),
    1067             :       mxBaseWindow(rxBaseWindow),
    1068             :       maPosition(0,0),
    1069           0 :       maSpriteSize(rSpriteSize)
    1070             : {
    1071           0 : }
    1072             : 
    1073             : 
    1074             : 
    1075             : 
    1076           0 : PresenterCustomSprite::~PresenterCustomSprite (void)
    1077             : {
    1078           0 : }
    1079             : 
    1080             : 
    1081             : 
    1082             : 
    1083           0 : void SAL_CALL PresenterCustomSprite::disposing (void)
    1084             :     throw (RuntimeException)
    1085             : {
    1086           0 :     Reference<XComponent> xComponent (mxSprite, UNO_QUERY);
    1087           0 :     mxSprite = NULL;
    1088           0 :     if (xComponent.is())
    1089           0 :         xComponent->dispose();
    1090           0 :     mpCanvas = rtl::Reference<PresenterCanvas>();
    1091           0 : }
    1092             : 
    1093             : 
    1094             : 
    1095             : 
    1096             : //----- XSprite ---------------------------------------------------------------
    1097             : 
    1098           0 : void SAL_CALL PresenterCustomSprite::setAlpha (const double nAlpha)
    1099             :     throw (lang::IllegalArgumentException,RuntimeException)
    1100             : {
    1101           0 :     ThrowIfDisposed();
    1102           0 :     mxSprite->setAlpha(nAlpha);
    1103           0 : }
    1104             : 
    1105             : 
    1106             : 
    1107             : 
    1108           0 : void SAL_CALL PresenterCustomSprite::move (
    1109             :     const geometry::RealPoint2D& rNewPos,
    1110             :     const rendering::ViewState& rViewState,
    1111             :     const rendering::RenderState& rRenderState)
    1112             :     throw (lang::IllegalArgumentException,RuntimeException)
    1113             : {
    1114           0 :     ThrowIfDisposed();
    1115           0 :     maPosition = rNewPos;
    1116           0 :     mxSprite->move(
    1117             :         rNewPos,
    1118           0 :         mpCanvas->MergeViewState(rViewState, mpCanvas->GetOffset(mxBaseWindow)),
    1119           0 :         rRenderState);
    1120             :     // Clip sprite against window bounds.  This call is necessary because
    1121             :     // sprite clipping is done in the corrdinate system of the sprite.
    1122             :     // Therefore, after each change of the sprites location the window
    1123             :     // bounds have to be transformed into the sprites coordinate system.
    1124           0 :     clip(NULL);
    1125           0 : }
    1126             : 
    1127             : 
    1128             : 
    1129             : 
    1130           0 : void SAL_CALL PresenterCustomSprite::transform (const geometry::AffineMatrix2D& rTransformation)
    1131             :     throw (lang::IllegalArgumentException,RuntimeException)
    1132             : {
    1133           0 :     ThrowIfDisposed();
    1134           0 :     mxSprite->transform(rTransformation);
    1135           0 : }
    1136             : 
    1137             : 
    1138             : 
    1139             : 
    1140           0 : void SAL_CALL PresenterCustomSprite::clip (const Reference<rendering::XPolyPolygon2D>& rxClip)
    1141             :     throw (RuntimeException)
    1142             : {
    1143           0 :     ThrowIfDisposed();
    1144             :     // The clip region is expected in the coordinate system of the sprite.
    1145             :     // UpdateSpriteClip() integrates the window bounds, transformed into the
    1146             :     // sprites coordinate system, with the given clip.
    1147           0 :     mxSprite->clip(mpCanvas->UpdateSpriteClip(rxClip, maPosition, maSpriteSize));
    1148           0 : }
    1149             : 
    1150             : 
    1151             : 
    1152             : 
    1153           0 : void SAL_CALL PresenterCustomSprite::setPriority (const double nPriority)
    1154             :     throw (RuntimeException)
    1155             : {
    1156           0 :     ThrowIfDisposed();
    1157           0 :     mxSprite->setPriority(nPriority);
    1158           0 : }
    1159             : 
    1160             : 
    1161             : 
    1162           0 : void SAL_CALL PresenterCustomSprite::show (void)
    1163             :     throw (RuntimeException)
    1164             : {
    1165           0 :     ThrowIfDisposed();
    1166           0 :     mxSprite->show();
    1167           0 : }
    1168             : 
    1169             : 
    1170             : 
    1171             : 
    1172           0 : void SAL_CALL PresenterCustomSprite::hide (void)
    1173             :     throw (RuntimeException)
    1174             : {
    1175           0 :     ThrowIfDisposed();
    1176           0 :     mxSprite->hide();
    1177           0 : }
    1178             : 
    1179             : 
    1180             : 
    1181             : 
    1182             : //----- XCustomSprite ---------------------------------------------------------
    1183             : 
    1184           0 : Reference<rendering::XCanvas> PresenterCustomSprite::getContentCanvas (void)
    1185             :     throw (RuntimeException)
    1186             : {
    1187           0 :     ThrowIfDisposed();
    1188           0 :     return mxSprite->getContentCanvas();
    1189             : }
    1190             : 
    1191             : 
    1192             : 
    1193             : 
    1194             : //-----------------------------------------------------------------------------
    1195             : 
    1196           0 : void PresenterCustomSprite::ThrowIfDisposed (void)
    1197             :     throw (css::lang::DisposedException)
    1198             : {
    1199           0 :     if (rBHelper.bDisposed || rBHelper.bInDispose || ! mxSprite.is())
    1200             :     {
    1201             :         throw lang::DisposedException ("PresenterCustomSprite object has already been disposed",
    1202           0 :             static_cast<uno::XWeak*>(this));
    1203             :     }
    1204           0 : }
    1205             : 
    1206             : 
    1207             : 
    1208             : 
    1209          33 : } } // end of namespace ::sd::presenter
    1210             : 
    1211             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10