Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef INCLUDED_CANVAS_BASE_INTEGERBITMAPBASE_HXX
21 : #define INCLUDED_CANVAS_BASE_INTEGERBITMAPBASE_HXX
22 :
23 : #include <com/sun/star/rendering/XIntegerBitmap.hpp>
24 : #include <canvas/base/bitmapcanvasbase.hxx>
25 :
26 :
27 : namespace canvas
28 : {
29 : /** Helper template to handle XIntegerBitmap method forwarding to
30 : BitmapCanvasHelper
31 :
32 : Use this helper to handle the XIntegerBitmap part of your
33 : implementation.
34 :
35 : @tpl Base
36 : Either BitmapCanvasBase (just XBitmap) or BitmapCanvasBase2 (XBitmap and
37 : XBitmapCanvas).
38 : */
39 10 : template< class Base > class IntegerBitmapBase :
40 : public Base
41 : {
42 : public:
43 : // XIntegerBitmap
44 0 : virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getData( ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout,
45 : const ::com::sun::star::geometry::IntegerRectangle2D& rect ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::rendering::VolatileContentDestroyedException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
46 : {
47 0 : tools::verifyArgs(rect,
48 : BOOST_CURRENT_FUNCTION,
49 0 : static_cast< typename Base::UnambiguousBaseType* >(this));
50 0 : tools::verifyIndexRange(rect, Base::getSize() );
51 :
52 0 : typename Base::MutexType aGuard( Base::m_aMutex );
53 :
54 : return Base::maCanvasHelper.getData( bitmapLayout,
55 0 : rect );
56 : }
57 :
58 0 : virtual void SAL_CALL setData( const ::com::sun::star::uno::Sequence< sal_Int8 >&,
59 : const ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout,
60 : const ::com::sun::star::geometry::IntegerRectangle2D& rect ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
61 : {
62 0 : tools::verifyArgs(bitmapLayout, rect,
63 : BOOST_CURRENT_FUNCTION,
64 0 : static_cast< typename Base::UnambiguousBaseType* >(this));
65 0 : tools::verifyIndexRange(rect, Base::getSize() );
66 :
67 0 : typename Base::MutexType aGuard( Base::m_aMutex );
68 :
69 0 : Base::mbSurfaceDirty = true;
70 0 : }
71 :
72 0 : virtual void SAL_CALL setPixel( const ::com::sun::star::uno::Sequence< sal_Int8 >&,
73 : const ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout,
74 : const ::com::sun::star::geometry::IntegerPoint2D& pos ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
75 : {
76 0 : tools::verifyArgs(bitmapLayout, pos,
77 : BOOST_CURRENT_FUNCTION,
78 0 : static_cast< typename Base::UnambiguousBaseType* >(this));
79 0 : tools::verifyIndexRange(pos, Base::getSize() );
80 :
81 0 : typename Base::MutexType aGuard( Base::m_aMutex );
82 :
83 0 : Base::mbSurfaceDirty = true;
84 0 : }
85 :
86 0 : virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getPixel( ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout,
87 : const ::com::sun::star::geometry::IntegerPoint2D& pos ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::rendering::VolatileContentDestroyedException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
88 : {
89 0 : tools::verifyArgs(pos,
90 : BOOST_CURRENT_FUNCTION,
91 0 : static_cast< typename Base::UnambiguousBaseType* >(this));
92 0 : tools::verifyIndexRange(pos, Base::getSize() );
93 :
94 0 : typename Base::MutexType aGuard( Base::m_aMutex );
95 :
96 : return Base::maCanvasHelper.getPixel( bitmapLayout,
97 0 : pos );
98 : }
99 :
100 0 : virtual ::com::sun::star::rendering::IntegerBitmapLayout SAL_CALL getMemoryLayout( ) throw (::com::sun::star::uno::RuntimeException) SAL_OVERRIDE
101 : {
102 0 : typename Base::MutexType aGuard( Base::m_aMutex );
103 :
104 0 : return Base::maCanvasHelper.getMemoryLayout();
105 : }
106 : };
107 : }
108 :
109 : #endif // INCLUDED_CANVAS_BASE_INTEGERBITMAPBASE_HXX
110 :
111 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|