fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / include / canvas / base / bitmapcanvasbase.hxx
blob5c1376b0632b3fbb05fd8b6654a3e76717addf4b
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_CANVAS_BITMAPCANVASBASE_HXX
21 #define INCLUDED_CANVAS_BITMAPCANVASBASE_HXX
23 #include <canvas/base/canvasbase.hxx>
24 #include <com/sun/star/rendering/XBitmapCanvas.hpp>
26 namespace canvas
28 /** Helper template to handle XBitmapCanvas method forwarding to
29 BitmapCanvasHelper
31 Use this helper to handle the XBitmapCanvas part of your
32 implementation.
34 @tpl Base
35 Base class to use, most probably one of the
36 WeakComponentImplHelperN templates with the appropriate
37 interfaces. At least XBitmapCanvas should be among them (why
38 else would you use this template, then?). Base class must have
39 an Base( const Mutex& ) constructor (like the
40 WeakComponentImplHelperN templates have).
42 @tpl CanvasHelper
43 Canvas helper implementation for the backend in question
45 @tpl Mutex
46 Lock strategy to use. Defaults to using the
47 OBaseMutex-provided lock. Everytime one of the methods is
48 entered, an object of type Mutex is created with m_aMutex as
49 the sole parameter, and destroyed again when the method scope
50 is left.
52 @tpl UnambiguousBase
53 Optional unambiguous base class for XInterface of Base. It's
54 sometimes necessary to specify this parameter, e.g. if Base
55 derives from multiple UNO interface (were each provides its
56 own version of XInterface, making the conversion ambiguous)
58 @see CanvasBase for further contractual requirements towards
59 the CanvasHelper type, and some examples.
61 template< class Base,
62 class CanvasHelper,
63 class Mutex=::osl::MutexGuard,
64 class UnambiguousBase=::com::sun::star::uno::XInterface > class BitmapCanvasBase :
65 public CanvasBase< Base, CanvasHelper, Mutex, UnambiguousBase >
67 public:
68 typedef CanvasBase< Base, CanvasHelper, Mutex, UnambiguousBase > BaseType;
70 // XBitmapCanvas
71 virtual void SAL_CALL copyRect( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmapCanvas >& sourceCanvas,
72 const ::com::sun::star::geometry::RealRectangle2D& sourceRect,
73 const ::com::sun::star::rendering::ViewState& sourceViewState,
74 const ::com::sun::star::rendering::RenderState& sourceRenderState,
75 const ::com::sun::star::geometry::RealRectangle2D& destRect,
76 const ::com::sun::star::rendering::ViewState& destViewState,
77 const ::com::sun::star::rendering::RenderState& destRenderState ) throw (::com::sun::star::lang::IllegalArgumentException,
78 ::com::sun::star::uno::RuntimeException)
80 tools::verifyArgs(sourceCanvas, sourceRect, sourceViewState, sourceRenderState,
81 destRect, destViewState, destRenderState,
82 BOOST_CURRENT_FUNCTION,
83 static_cast< typename BaseType::UnambiguousBaseType* >(this));
85 typename BaseType::MutexType aGuard( BaseType::m_aMutex );
87 BaseType::mbSurfaceDirty = true;
88 BaseType::maCanvasHelper.modifying();
90 BaseType::maCanvasHelper.copyRect( this,
91 sourceCanvas,
92 sourceRect,
93 sourceViewState,
94 sourceRenderState,
95 destRect,
96 destViewState,
97 destRenderState );
100 // XBitmap
101 virtual ::com::sun::star::geometry::IntegerSize2D SAL_CALL getSize( ) throw (::com::sun::star::uno::RuntimeException)
103 typename BaseType::MutexType aGuard( BaseType::m_aMutex );
105 return BaseType::maCanvasHelper.getSize();
108 virtual ::sal_Bool SAL_CALL hasAlpha( ) throw (::com::sun::star::uno::RuntimeException)
110 typename BaseType::MutexType aGuard( BaseType::m_aMutex );
112 return BaseType::maCanvasHelper.hasAlpha();
115 virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmap > SAL_CALL getScaledBitmap( const ::com::sun::star::geometry::RealSize2D& newSize,
116 sal_Bool beFast ) throw (::com::sun::star::uno::RuntimeException)
118 typename BaseType::MutexType aGuard( BaseType::m_aMutex );
120 return BaseType::maCanvasHelper.getScaledBitmap( newSize, beFast );
126 #endif /* INCLUDED_CANVAS_BITMAPCANVASBASE_HXX */
128 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */