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