tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / canvas / inc / base / bitmapcanvasbase.hxx
blob1293f301fdb1dd08b36d8287b963b2966baaeff1
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 <base/canvasbase.hxx>
23 #include <com/sun/star/geometry/IntegerSize2D.hpp>
25 namespace com::sun::star::rendering { class XBitmapCanvas; }
27 namespace canvas
29 /** Helper template to handle XBitmapCanvas method forwarding to
30 BitmapCanvasHelper
32 Use this helper to handle the XBitmapCanvas part of your
33 implementation.
35 @tpl Base
36 Base class to use, most probably one of the
37 WeakComponentImplHelperN templates with the appropriate
38 interfaces. At least XBitmapCanvas should be among them (why
39 else would you use this template, then?). Base class must have
40 a Base( const Mutex& ) constructor (like the
41 WeakComponentImplHelperN templates have).
43 @tpl CanvasHelper
44 Canvas helper implementation for the backend in question
46 @tpl Mutex
47 Lock strategy to use. Defaults to using the
48 BaseMutex-provided lock. Every time one of the methods is
49 entered, an object of type Mutex is created with m_aMutex as
50 the sole parameter, and destroyed again when the method scope
51 is left.
53 @tpl UnambiguousBase
54 Optional unambiguous base class for XInterface of Base. It's
55 sometimes necessary to specify this parameter, e.g. if Base
56 derives from multiple UNO interface (were each provides its
57 own version of XInterface, making the conversion ambiguous)
59 @see CanvasBase for further contractual requirements towards
60 the CanvasHelper type, and some examples.
62 template< class Base,
63 class CanvasHelper,
64 class Mutex=::osl::MutexGuard,
65 class UnambiguousBase=css::uno::XInterface > class BitmapCanvasBase :
66 public CanvasBase< Base, CanvasHelper, Mutex, UnambiguousBase >
68 public:
69 typedef CanvasBase< Base, CanvasHelper, Mutex, UnambiguousBase > BaseType;
71 // XBitmap
72 virtual css::geometry::IntegerSize2D SAL_CALL getSize( ) override
74 typename BaseType::MutexType aGuard( BaseType::m_aMutex );
76 return BaseType::maCanvasHelper.getSize();
79 virtual sal_Bool SAL_CALL hasAlpha( ) override
81 return true;
84 virtual css::uno::Reference< css::rendering::XBitmap > SAL_CALL getScaledBitmap( const css::geometry::RealSize2D& newSize,
85 sal_Bool beFast ) override
87 typename BaseType::MutexType aGuard( BaseType::m_aMutex );
89 return BaseType::maCanvasHelper.getScaledBitmap( newSize, beFast );
94 template< class Base,
95 class CanvasHelper,
96 class Mutex=::osl::MutexGuard,
97 class UnambiguousBase = css::uno::XInterface > class BitmapCanvasBase2 :
98 public BitmapCanvasBase< Base, CanvasHelper, Mutex, UnambiguousBase >
100 typedef BitmapCanvasBase< Base, CanvasHelper, Mutex, UnambiguousBase >
101 BaseType;
103 public:
104 // XBitmapCanvas
105 virtual void SAL_CALL copyRect( const css::uno::Reference< css::rendering::XBitmapCanvas >& sourceCanvas,
106 const css::geometry::RealRectangle2D& sourceRect,
107 const css::rendering::ViewState& sourceViewState,
108 const css::rendering::RenderState& sourceRenderState,
109 const css::geometry::RealRectangle2D& destRect,
110 const css::rendering::ViewState& destViewState,
111 const css::rendering::RenderState& destRenderState ) override
113 tools::verifyArgs(sourceCanvas, sourceRect, sourceViewState, sourceRenderState,
114 destRect, destViewState, destRenderState,
115 __func__,
116 static_cast< typename BaseType::UnambiguousBaseType* >(this));
118 typename BaseType::BaseType::MutexType aGuard( BaseType::m_aMutex );
120 BaseType::BaseType::mbSurfaceDirty = true;
125 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */