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