Branch libreoffice-5-0-4
[LibreOffice.git] / canvas / source / directx / dx_canvasbitmap.hxx
blob680848dca23e890ba5a1c1b1ded34e389b4886bc
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_SOURCE_DIRECTX_DX_CANVASBITMAP_HXX
21 #define INCLUDED_CANVAS_SOURCE_DIRECTX_DX_CANVASBITMAP_HXX
23 #include <cppuhelper/compbase4.hxx>
25 #include <com/sun/star/lang/XServiceInfo.hpp>
26 #include <com/sun/star/rendering/XBitmapCanvas.hpp>
27 #include <com/sun/star/rendering/XIntegerBitmap.hpp>
28 #include <com/sun/star/beans/XFastPropertySet.hpp>
30 #include <basegfx/vector/b2isize.hxx>
32 #include <boost/shared_ptr.hpp>
34 #include <cppuhelper/compbase3.hxx>
35 #include <comphelper/uno3.hxx>
36 #include <canvas/base/basemutexhelper.hxx>
37 #include <canvas/base/integerbitmapbase.hxx>
39 #include "dx_bitmapprovider.hxx"
40 #include "dx_bitmapcanvashelper.hxx"
41 #include "dx_devicehelper.hxx"
42 #include "dx_impltools.hxx"
43 #include "dx_ibitmap.hxx"
46 /* Definition of CanvasBitmap class */
48 namespace dxcanvas
50 typedef ::cppu::WeakComponentImplHelper4< ::com::sun::star::rendering::XBitmapCanvas,
51 ::com::sun::star::rendering::XIntegerBitmap,
52 ::com::sun::star::lang::XServiceInfo,
53 ::com::sun::star::beans::XFastPropertySet > CanvasBitmapBase_Base;
54 typedef ::canvas::IntegerBitmapBase<
55 canvas::BitmapCanvasBase2<
56 ::canvas::BaseMutexHelper< CanvasBitmapBase_Base >,
57 BitmapCanvasHelper,
58 ::osl::MutexGuard,
59 ::cppu::OWeakObject> > CanvasBitmap_Base;
61 class CanvasBitmap : public CanvasBitmap_Base, public BitmapProvider
63 public:
64 /** Create a canvas bitmap for the given surface
66 @param rSurface
67 Surface to create API object for.
69 @param rDevice
70 Reference device, with which bitmap should be compatible
72 CanvasBitmap( const IBitmapSharedPtr& rSurface,
73 const DeviceRef& rDevice );
75 /// Dispose all internal references
76 virtual void disposeThis() SAL_OVERRIDE;
78 // XServiceInfo
79 virtual OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException);
80 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
81 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException);
83 // BitmapProvider
84 virtual IBitmapSharedPtr getBitmap() const { return mpBitmap; }
86 virtual ::com::sun::star::uno::Any SAL_CALL getFastPropertyValue(sal_Int32 nHandle) throw (::com::sun::star::uno::RuntimeException);
87 virtual void SAL_CALL setFastPropertyValue(sal_Int32, const ::com::sun::star::uno::Any&) throw (::com::sun::star::uno::RuntimeException) {}
89 private:
90 /** MUST hold here, too, since CanvasHelper only contains a
91 raw pointer (without refcounting)
93 DeviceRef mpDevice;
94 IBitmapSharedPtr mpBitmap;
98 #endif // INCLUDED_CANVAS_SOURCE_DIRECTX_DX_CANVASBITMAP_HXX
100 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */