Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef INCLUDED_CANVAS_CANVASBASE_HXX
30 : : #define INCLUDED_CANVAS_CANVASBASE_HXX
31 : :
32 : : #include <com/sun/star/uno/Reference.hxx>
33 : : #include <com/sun/star/rendering/XCanvas.hpp>
34 : : #include <com/sun/star/rendering/TextDirection.hpp>
35 : : #include <osl/mutex.hxx>
36 : : #include <canvas/verifyinput.hxx>
37 : :
38 : :
39 : : namespace canvas
40 : : {
41 : : /** Helper template to handle XCanvas method forwarding to CanvasHelper
42 : :
43 : : Use this helper to handle the XCanvas part of your
44 : : implementation. In theory, we could have provided CanvasHelper
45 : : and CanvasBase as a single template, but that would duplicate
46 : : a lot of code now residing in CanvasHelper only.
47 : :
48 : : This template basically interposes itself between the full
49 : : interface you implement (i.e. not restricted to XCanvas. The
50 : : problem with UNO partial interface implementation actually is,
51 : : that you cannot do it the plain way, since deriving from a
52 : : common base subclass always introduces the whole set of pure
53 : : virtuals, that your baseclass helper just overrided) and your
54 : : implementation class. You then only have to implement the
55 : : functionality <em>besides</em> XCanvas.
56 : :
57 : : <pre>
58 : : Example:
59 : : typedef ::cppu::WeakComponentImplHelper4< ::com::sun::star::rendering::XSpriteCanvas,
60 : : ::com::sun::star::lang::XInitialization,
61 : : ::com::sun::star::lang::XServiceInfo,
62 : : ::com::sun::star::lang::XServiceName > CanvasBase_Base;
63 : : typedef ::canvas::internal::CanvasBase< CanvasBase_Base, CanvasHelper > ExampleCanvas_Base;
64 : :
65 : : class ExampleCanvas : public ExampleCanvas_Base,
66 : : public SpriteSurface,
67 : : public RepaintTarget
68 : : {
69 : : };
70 : : </pre>
71 : :
72 : : @tpl Base
73 : : Base class to use, most probably one of the
74 : : WeakComponentImplHelperN templates with the appropriate
75 : : interfaces. At least XCanvas should be among them (why else
76 : : would you use this template, then?). Base class must have an
77 : : Base( const Mutex& ) constructor (like the
78 : : WeakComponentImplHelperN templates have). As the very least,
79 : : the base class must be derived from uno::XInterface, as some
80 : : error reporting mechanisms rely on that.
81 : :
82 : : @tpl CanvasHelper
83 : : Canvas helper implementation for the backend in question. This
84 : : object will be held as a member of this template class, and
85 : : basically gets forwarded all XCanvas API calls. Furthermore,
86 : : everytime the canvas API semantically changes the content of
87 : : the canvas, CanvasHelper::modifying() will get called
88 : : (<em>before</em> the actual modification takes place).
89 : :
90 : : @tpl Mutex
91 : : Lock strategy to use. Defaults to using the
92 : : OBaseMutex-provided lock. Everytime one of the methods is
93 : : entered, an object of type Mutex is created with m_aMutex as
94 : : the sole parameter, and destroyed again when the method scope
95 : : is left.
96 : :
97 : : @tpl UnambiguousBase
98 : : Optional unambiguous base class for XInterface of Base. It's
99 : : sometimes necessary to specify this parameter, e.g. if Base
100 : : derives from multiple UNO interface (were each provides its
101 : : own version of XInterface, making the conversion ambiguous)
102 : : */
103 : : template< class Base,
104 : : class CanvasHelper,
105 : : class Mutex=::osl::MutexGuard,
106 : : class UnambiguousBase=::com::sun::star::uno::XInterface > class CanvasBase :
107 : : public Base
108 : : {
109 : : public:
110 : : typedef Base BaseType;
111 : : typedef CanvasHelper HelperType;
112 : : typedef Mutex MutexType;
113 : : typedef UnambiguousBase UnambiguousBaseType;
114 : :
115 : : /** Create CanvasBase
116 : : */
117 : 0 : CanvasBase() :
118 : : maCanvasHelper(),
119 : 0 : mbSurfaceDirty( true )
120 : : {
121 : 0 : }
122 : :
123 : 0 : virtual void disposeThis()
124 : : {
125 : 0 : MutexType aGuard( BaseType::m_aMutex );
126 : :
127 : 0 : maCanvasHelper.disposing();
128 : :
129 : : // pass on to base class
130 : 0 : BaseType::disposeThis();
131 : 0 : }
132 : :
133 : : // XCanvas
134 : 0 : virtual void SAL_CALL clear() throw (::com::sun::star::uno::RuntimeException)
135 : : {
136 : 0 : MutexType aGuard( BaseType::m_aMutex );
137 : :
138 : 0 : mbSurfaceDirty = true;
139 : 0 : maCanvasHelper.modifying();
140 : :
141 : 0 : maCanvasHelper.clear();
142 : 0 : }
143 : :
144 : 0 : virtual void SAL_CALL drawPoint( const ::com::sun::star::geometry::RealPoint2D& aPoint,
145 : : const ::com::sun::star::rendering::ViewState& viewState,
146 : : const ::com::sun::star::rendering::RenderState& renderState ) throw (::com::sun::star::lang::IllegalArgumentException,
147 : : ::com::sun::star::uno::RuntimeException)
148 : : {
149 : 0 : tools::verifyArgs(aPoint, viewState, renderState,
150 : : BOOST_CURRENT_FUNCTION,
151 : : static_cast< UnambiguousBaseType* >(this));
152 : :
153 : 0 : MutexType aGuard( BaseType::m_aMutex );
154 : :
155 : 0 : mbSurfaceDirty = true;
156 : 0 : maCanvasHelper.modifying();
157 : :
158 : 0 : maCanvasHelper.drawPoint( this, aPoint, viewState, renderState );
159 : 0 : }
160 : :
161 : 0 : virtual void SAL_CALL drawLine( const ::com::sun::star::geometry::RealPoint2D& aStartPoint,
162 : : const ::com::sun::star::geometry::RealPoint2D& aEndPoint,
163 : : const ::com::sun::star::rendering::ViewState& viewState,
164 : : const ::com::sun::star::rendering::RenderState& renderState ) throw (::com::sun::star::lang::IllegalArgumentException,
165 : : ::com::sun::star::uno::RuntimeException)
166 : : {
167 : 0 : tools::verifyArgs(aStartPoint, aEndPoint, viewState, renderState,
168 : : BOOST_CURRENT_FUNCTION,
169 : : static_cast< UnambiguousBaseType* >(this));
170 : :
171 : 0 : MutexType aGuard( BaseType::m_aMutex );
172 : :
173 : 0 : mbSurfaceDirty = true;
174 : 0 : maCanvasHelper.modifying();
175 : :
176 : 0 : maCanvasHelper.drawLine( this, aStartPoint, aEndPoint, viewState, renderState );
177 : 0 : }
178 : :
179 : 0 : virtual void SAL_CALL drawBezier( const ::com::sun::star::geometry::RealBezierSegment2D& aBezierSegment,
180 : : const ::com::sun::star::geometry::RealPoint2D& aEndPoint,
181 : : const ::com::sun::star::rendering::ViewState& viewState,
182 : : const ::com::sun::star::rendering::RenderState& renderState ) throw (::com::sun::star::lang::IllegalArgumentException,
183 : : ::com::sun::star::uno::RuntimeException)
184 : : {
185 : 0 : tools::verifyArgs(aBezierSegment, aEndPoint, viewState, renderState,
186 : : BOOST_CURRENT_FUNCTION,
187 : : static_cast< UnambiguousBaseType* >(this));
188 : :
189 : 0 : MutexType aGuard( BaseType::m_aMutex );
190 : :
191 : 0 : mbSurfaceDirty = true;
192 : 0 : maCanvasHelper.modifying();
193 : :
194 : 0 : maCanvasHelper.drawBezier( this, aBezierSegment, aEndPoint, viewState, renderState );
195 : 0 : }
196 : :
197 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive > SAL_CALL
198 : 0 : drawPolyPolygon( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon,
199 : : const ::com::sun::star::rendering::ViewState& viewState,
200 : : const ::com::sun::star::rendering::RenderState& renderState ) throw (::com::sun::star::lang::IllegalArgumentException,
201 : : ::com::sun::star::uno::RuntimeException)
202 : : {
203 : 0 : tools::verifyArgs(xPolyPolygon, viewState, renderState,
204 : : BOOST_CURRENT_FUNCTION,
205 : : static_cast< UnambiguousBaseType* >(this));
206 : :
207 : 0 : MutexType aGuard( BaseType::m_aMutex );
208 : :
209 : 0 : mbSurfaceDirty = true;
210 : 0 : maCanvasHelper.modifying();
211 : :
212 : 0 : return maCanvasHelper.drawPolyPolygon( this, xPolyPolygon, viewState, renderState );
213 : : }
214 : :
215 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive > SAL_CALL
216 : 0 : strokePolyPolygon( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon,
217 : : const ::com::sun::star::rendering::ViewState& viewState,
218 : : const ::com::sun::star::rendering::RenderState& renderState,
219 : : const ::com::sun::star::rendering::StrokeAttributes& strokeAttributes ) throw (::com::sun::star::lang::IllegalArgumentException,
220 : : ::com::sun::star::uno::RuntimeException)
221 : : {
222 : 0 : tools::verifyArgs(xPolyPolygon, viewState, renderState, strokeAttributes,
223 : : BOOST_CURRENT_FUNCTION,
224 : : static_cast< UnambiguousBaseType* >(this));
225 : :
226 : 0 : MutexType aGuard( BaseType::m_aMutex );
227 : :
228 : 0 : mbSurfaceDirty = true;
229 : 0 : maCanvasHelper.modifying();
230 : :
231 : 0 : return maCanvasHelper.strokePolyPolygon( this, xPolyPolygon, viewState, renderState, strokeAttributes );
232 : : }
233 : :
234 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive > SAL_CALL
235 : 0 : strokeTexturedPolyPolygon( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon,
236 : : const ::com::sun::star::rendering::ViewState& viewState,
237 : : const ::com::sun::star::rendering::RenderState& renderState,
238 : : const ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::Texture >& textures,
239 : : const ::com::sun::star::rendering::StrokeAttributes& strokeAttributes ) throw (::com::sun::star::lang::IllegalArgumentException,
240 : : ::com::sun::star::uno::RuntimeException)
241 : : {
242 : 0 : tools::verifyArgs(xPolyPolygon, viewState, renderState, strokeAttributes,
243 : : BOOST_CURRENT_FUNCTION,
244 : : static_cast< UnambiguousBaseType* >(this));
245 : :
246 : 0 : MutexType aGuard( BaseType::m_aMutex );
247 : :
248 : 0 : mbSurfaceDirty = true;
249 : 0 : maCanvasHelper.modifying();
250 : :
251 : 0 : return maCanvasHelper.strokeTexturedPolyPolygon( this, xPolyPolygon, viewState, renderState, textures, strokeAttributes );
252 : : }
253 : :
254 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive > SAL_CALL
255 : 0 : strokeTextureMappedPolyPolygon( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon,
256 : : const ::com::sun::star::rendering::ViewState& viewState,
257 : : const ::com::sun::star::rendering::RenderState& renderState,
258 : : const ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::Texture >& textures,
259 : : const ::com::sun::star::uno::Reference< ::com::sun::star::geometry::XMapping2D >& xMapping,
260 : : const ::com::sun::star::rendering::StrokeAttributes& strokeAttributes ) throw (::com::sun::star::lang::IllegalArgumentException,
261 : : ::com::sun::star::uno::RuntimeException)
262 : : {
263 : 0 : tools::verifyArgs(xPolyPolygon, viewState, renderState, textures, xMapping, strokeAttributes,
264 : : BOOST_CURRENT_FUNCTION,
265 : : static_cast< UnambiguousBaseType* >(this));
266 : :
267 : 0 : MutexType aGuard( BaseType::m_aMutex );
268 : :
269 : 0 : mbSurfaceDirty = true;
270 : 0 : maCanvasHelper.modifying();
271 : :
272 : 0 : return maCanvasHelper.strokeTextureMappedPolyPolygon( this, xPolyPolygon, viewState, renderState, textures, xMapping, strokeAttributes );
273 : : }
274 : :
275 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D > SAL_CALL
276 : 0 : queryStrokeShapes( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon,
277 : : const ::com::sun::star::rendering::ViewState& viewState,
278 : : const ::com::sun::star::rendering::RenderState& renderState,
279 : : const ::com::sun::star::rendering::StrokeAttributes& strokeAttributes ) throw (::com::sun::star::lang::IllegalArgumentException,
280 : : ::com::sun::star::uno::RuntimeException)
281 : : {
282 : 0 : tools::verifyArgs(xPolyPolygon, viewState, renderState, strokeAttributes,
283 : : BOOST_CURRENT_FUNCTION,
284 : : static_cast< UnambiguousBaseType* >(this));
285 : :
286 : 0 : MutexType aGuard( BaseType::m_aMutex );
287 : :
288 : 0 : mbSurfaceDirty = true;
289 : 0 : maCanvasHelper.modifying();
290 : :
291 : 0 : return maCanvasHelper.queryStrokeShapes( this, xPolyPolygon, viewState, renderState, strokeAttributes );
292 : : }
293 : :
294 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive > SAL_CALL
295 : 0 : fillPolyPolygon( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon,
296 : : const ::com::sun::star::rendering::ViewState& viewState,
297 : : const ::com::sun::star::rendering::RenderState& renderState ) throw (::com::sun::star::lang::IllegalArgumentException,
298 : : ::com::sun::star::uno::RuntimeException)
299 : : {
300 : 0 : tools::verifyArgs(xPolyPolygon, viewState, renderState,
301 : : BOOST_CURRENT_FUNCTION,
302 : : static_cast< UnambiguousBaseType* >(this));
303 : :
304 : 0 : MutexType aGuard( BaseType::m_aMutex );
305 : :
306 : 0 : mbSurfaceDirty = true;
307 : 0 : maCanvasHelper.modifying();
308 : :
309 : 0 : return maCanvasHelper.fillPolyPolygon( this, xPolyPolygon, viewState, renderState );
310 : : }
311 : :
312 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive > SAL_CALL
313 : 0 : fillTexturedPolyPolygon( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon,
314 : : const ::com::sun::star::rendering::ViewState& viewState,
315 : : const ::com::sun::star::rendering::RenderState& renderState,
316 : : const ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::Texture >& textures ) throw (::com::sun::star::lang::IllegalArgumentException,
317 : : ::com::sun::star::uno::RuntimeException)
318 : : {
319 : 0 : tools::verifyArgs(xPolyPolygon, viewState, renderState, textures,
320 : : BOOST_CURRENT_FUNCTION,
321 : : static_cast< UnambiguousBaseType* >(this));
322 : :
323 : 0 : MutexType aGuard( BaseType::m_aMutex );
324 : :
325 : 0 : mbSurfaceDirty = true;
326 : 0 : maCanvasHelper.modifying();
327 : :
328 : 0 : return maCanvasHelper.fillTexturedPolyPolygon( this, xPolyPolygon, viewState, renderState, textures );
329 : : }
330 : :
331 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive > SAL_CALL
332 : 0 : fillTextureMappedPolyPolygon( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon,
333 : : const ::com::sun::star::rendering::ViewState& viewState,
334 : : const ::com::sun::star::rendering::RenderState& renderState,
335 : : const ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::Texture >& textures,
336 : : const ::com::sun::star::uno::Reference< ::com::sun::star::geometry::XMapping2D >& xMapping ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
337 : : {
338 : 0 : tools::verifyArgs(xPolyPolygon, viewState, renderState, textures, xMapping,
339 : : BOOST_CURRENT_FUNCTION,
340 : : static_cast< UnambiguousBaseType* >(this));
341 : :
342 : 0 : MutexType aGuard( BaseType::m_aMutex );
343 : :
344 : 0 : mbSurfaceDirty = true;
345 : 0 : maCanvasHelper.modifying();
346 : :
347 : 0 : return maCanvasHelper.fillTextureMappedPolyPolygon( this, xPolyPolygon, viewState, renderState, textures, xMapping );
348 : : }
349 : :
350 : :
351 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCanvasFont > SAL_CALL
352 : 0 : createFont( const ::com::sun::star::rendering::FontRequest& fontRequest,
353 : : const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& extraFontProperties,
354 : : const ::com::sun::star::geometry::Matrix2D& fontMatrix ) throw (::com::sun::star::lang::IllegalArgumentException,
355 : : ::com::sun::star::uno::RuntimeException)
356 : : {
357 : 0 : tools::verifyArgs(fontRequest,
358 : : // dummy, to keep argPos in sync
359 : : fontRequest,
360 : : fontMatrix,
361 : : BOOST_CURRENT_FUNCTION,
362 : : static_cast< UnambiguousBaseType* >(this));
363 : :
364 : 0 : MutexType aGuard( BaseType::m_aMutex );
365 : :
366 : 0 : return maCanvasHelper.createFont( this, fontRequest, extraFontProperties, fontMatrix );
367 : : }
368 : :
369 : :
370 : : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::FontInfo > SAL_CALL
371 : 0 : queryAvailableFonts( const ::com::sun::star::rendering::FontInfo& aFilter,
372 : : const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aFontProperties ) throw (::com::sun::star::lang::IllegalArgumentException,
373 : : ::com::sun::star::uno::RuntimeException)
374 : : {
375 : 0 : tools::verifyArgs(aFilter,
376 : : BOOST_CURRENT_FUNCTION,
377 : : static_cast< UnambiguousBaseType* >(this));
378 : :
379 : 0 : MutexType aGuard( BaseType::m_aMutex );
380 : :
381 : 0 : return maCanvasHelper.queryAvailableFonts( this, aFilter, aFontProperties );
382 : : }
383 : :
384 : :
385 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive > SAL_CALL
386 : 0 : drawText( const ::com::sun::star::rendering::StringContext& text,
387 : : const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCanvasFont >& xFont,
388 : : const ::com::sun::star::rendering::ViewState& viewState,
389 : : const ::com::sun::star::rendering::RenderState& renderState,
390 : : sal_Int8 textDirection ) throw (::com::sun::star::lang::IllegalArgumentException,
391 : : ::com::sun::star::uno::RuntimeException)
392 : : {
393 : 0 : tools::verifyArgs(xFont, viewState, renderState,
394 : : BOOST_CURRENT_FUNCTION,
395 : : static_cast< UnambiguousBaseType* >(this));
396 : : tools::verifyRange( textDirection,
397 : : ::com::sun::star::rendering::TextDirection::WEAK_LEFT_TO_RIGHT,
398 : 0 : ::com::sun::star::rendering::TextDirection::STRONG_RIGHT_TO_LEFT );
399 : :
400 : 0 : MutexType aGuard( BaseType::m_aMutex );
401 : :
402 : 0 : mbSurfaceDirty = true;
403 : 0 : maCanvasHelper.modifying();
404 : :
405 : 0 : return maCanvasHelper.drawText( this, text, xFont, viewState, renderState, textDirection );
406 : : }
407 : :
408 : :
409 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive > SAL_CALL
410 : 0 : drawTextLayout( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XTextLayout >& layoutetText,
411 : : const ::com::sun::star::rendering::ViewState& viewState,
412 : : const ::com::sun::star::rendering::RenderState& renderState ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
413 : : {
414 : 0 : tools::verifyArgs(layoutetText, viewState, renderState,
415 : : BOOST_CURRENT_FUNCTION,
416 : : static_cast< UnambiguousBaseType* >(this));
417 : :
418 : 0 : MutexType aGuard( BaseType::m_aMutex );
419 : :
420 : 0 : mbSurfaceDirty = true;
421 : 0 : maCanvasHelper.modifying();
422 : :
423 : 0 : return maCanvasHelper.drawTextLayout( this, layoutetText, viewState, renderState );
424 : : }
425 : :
426 : :
427 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive > SAL_CALL
428 : 0 : drawBitmap( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmap >& xBitmap,
429 : : const ::com::sun::star::rendering::ViewState& viewState,
430 : : const ::com::sun::star::rendering::RenderState& renderState ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
431 : : {
432 : 0 : tools::verifyArgs(xBitmap, viewState, renderState,
433 : : BOOST_CURRENT_FUNCTION,
434 : : static_cast< UnambiguousBaseType* >(this));
435 : :
436 : 0 : MutexType aGuard( BaseType::m_aMutex );
437 : :
438 : 0 : mbSurfaceDirty = true;
439 : 0 : maCanvasHelper.modifying();
440 : :
441 : 0 : return maCanvasHelper.drawBitmap( this, xBitmap, viewState, renderState );
442 : : }
443 : :
444 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive > SAL_CALL
445 : 0 : drawBitmapModulated( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmap >& xBitmap,
446 : : const ::com::sun::star::rendering::ViewState& viewState,
447 : : const ::com::sun::star::rendering::RenderState& renderState ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
448 : : {
449 : 0 : tools::verifyArgs(xBitmap, viewState, renderState,
450 : : BOOST_CURRENT_FUNCTION,
451 : : static_cast< UnambiguousBaseType* >(this));
452 : :
453 : 0 : MutexType aGuard( BaseType::m_aMutex );
454 : :
455 : 0 : mbSurfaceDirty = true;
456 : 0 : maCanvasHelper.modifying();
457 : :
458 : 0 : return maCanvasHelper.drawBitmapModulated( this, xBitmap, viewState, renderState );
459 : : }
460 : :
461 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice > SAL_CALL
462 : 0 : getDevice() throw (::com::sun::star::uno::RuntimeException)
463 : : {
464 : 0 : MutexType aGuard( BaseType::m_aMutex );
465 : :
466 : 0 : return maCanvasHelper.getDevice();
467 : : }
468 : :
469 : : protected:
470 : 0 : ~CanvasBase() {} // we're a ref-counted UNO class. _We_ destroy ourselves.
471 : :
472 : : HelperType maCanvasHelper;
473 : : mutable bool mbSurfaceDirty;
474 : :
475 : : private:
476 : : CanvasBase( const CanvasBase& );
477 : : CanvasBase& operator=( const CanvasBase& );
478 : : };
479 : : }
480 : :
481 : : #endif /* INCLUDED_CANVAS_CANVASBASE_HXX */
482 : :
483 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|