Simplify a bit
[LibreOffice.git] / canvas / source / directx / dx_canvasbitmap.hxx
blobb1725b447dec7c6b94c8daed228295d318e73e54
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 #pragma once
22 #include <com/sun/star/lang/XServiceInfo.hpp>
23 #include <com/sun/star/rendering/XBitmapCanvas.hpp>
24 #include <com/sun/star/rendering/XIntegerBitmap.hpp>
25 #include <com/sun/star/beans/XFastPropertySet.hpp>
26 #include <basegfx/vector/b2isize.hxx>
27 #include <cppuhelper/compbase.hxx>
28 #include <base/basemutexhelper.hxx>
29 #include <base/bitmapcanvasbase.hxx>
30 #include <base/integerbitmapbase.hxx>
32 #include "dx_bitmapprovider.hxx"
33 #include "dx_bitmapcanvashelper.hxx"
34 #include "dx_devicehelper.hxx"
35 #include "dx_impltools.hxx"
36 #include "dx_ibitmap.hxx"
39 /* Definition of CanvasBitmap class */
41 namespace dxcanvas
43 typedef ::cppu::WeakComponentImplHelper< css::rendering::XBitmapCanvas,
44 css::rendering::XIntegerBitmap,
45 css::lang::XServiceInfo,
46 css::beans::XFastPropertySet > CanvasBitmapBase_Base;
47 typedef ::canvas::IntegerBitmapBase<
48 canvas::BitmapCanvasBase2<
49 ::canvas::BaseMutexHelper< CanvasBitmapBase_Base >,
50 BitmapCanvasHelper,
51 ::osl::MutexGuard,
52 ::cppu::OWeakObject> > CanvasBitmap_Base;
54 class CanvasBitmap : public CanvasBitmap_Base, public BitmapProvider
56 public:
57 /** Create a canvas bitmap for the given surface
59 @param rSurface
60 Surface to create API object for.
62 @param rDevice
63 Reference device, with which bitmap should be compatible
65 CanvasBitmap( const IBitmapSharedPtr& rSurface,
66 const DeviceRef& rDevice );
68 /// Dispose all internal references
69 virtual void disposeThis() override;
71 // XServiceInfo
72 virtual OUString SAL_CALL getImplementationName( ) override;
73 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
74 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
76 // BitmapProvider
77 virtual IBitmapSharedPtr getBitmap() const override { return mpBitmap; }
79 virtual css::uno::Any SAL_CALL getFastPropertyValue(sal_Int32 nHandle) override;
80 virtual void SAL_CALL setFastPropertyValue(sal_Int32, const css::uno::Any&) override {}
82 private:
83 /** MUST hold here, too, since CanvasHelper only contains a
84 raw pointer (without refcounting)
86 DeviceRef mpDevice;
87 IBitmapSharedPtr mpBitmap;
91 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */