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