LibreOffice Module canvas (master) 1
cairo_canvascustomsprite.hxx
Go to the documentation of this file.
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#pragma once
21
23#include <comphelper/uno3.hxx>
24
25#include <com/sun/star/lang/XServiceInfo.hpp>
26#include <com/sun/star/rendering/XBitmapCanvas.hpp>
27#include <com/sun/star/rendering/XCustomSprite.hpp>
28#include <com/sun/star/rendering/XIntegerBitmap.hpp>
29
31
34
35#include <vcl/cairo.hxx>
36
37#include "cairo_sprite.hxx"
42
43
44namespace cairocanvas
45{
46 typedef ::cppu::WeakComponentImplHelper< css::rendering::XCustomSprite,
47 css::rendering::XBitmapCanvas,
48 css::rendering::XIntegerBitmap,
49 css::lang::XServiceInfo > CanvasCustomSpriteBase_Base;
67 class CanvasCustomSpriteSpriteBase_Base : public ::canvas::BaseMutexHelper< CanvasCustomSpriteBase_Base >,
68 public Sprite,
69 public SurfaceProvider
70 {
71 };
72
76 ::osl::MutexGuard,
78
79 /* Definition of CanvasCustomSprite class */
80
82 public RepaintTarget
83 {
84 public:
99 CanvasCustomSprite( const css::geometry::RealSize2D& rSpriteSize,
100 const SpriteCanvasRef& rRefDevice );
101
102 virtual void disposeThis() override;
103
104 // Forwarding the XComponent implementation to the
105 // cppu::ImplHelper templated base
106 // Classname Base doing refcount Base implementing the XComponent interface
107 // | | |
108 // V V V
110
111 // XServiceInfo
112 virtual OUString SAL_CALL getImplementationName() override;
113 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
114 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
115
116 // Sprite
117 virtual void redraw( const ::cairo::CairoSharedPtr& pCairo,
118 bool bBufferedUpdate ) const override;
119 virtual void redraw( const ::cairo::CairoSharedPtr& pCairo,
120 const ::basegfx::B2DPoint& rOrigOutputPos,
121 bool bBufferedUpdate ) const override;
122
123 // RepaintTarget
124 virtual bool repaint( const ::cairo::SurfaceSharedPtr& pSurface,
125 const css::rendering::ViewState& viewState,
126 const css::rendering::RenderState& renderState ) override;
127
128 // SurfaceProvider
129 virtual ::cairo::SurfaceSharedPtr getSurface() override;
130 virtual ::cairo::SurfaceSharedPtr createSurface( const ::basegfx::B2ISize& rSize, int aContent ) override;
131 virtual ::cairo::SurfaceSharedPtr createSurface( ::Bitmap& rBitmap ) override;
132 virtual ::cairo::SurfaceSharedPtr changeSurface() override;
133 virtual OutputDevice* getOutputDevice() override;
134
135 private:
142 };
143}
144
145/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual ::cairo::SurfaceSharedPtr changeSurface() override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual bool repaint(const ::cairo::SurfaceSharedPtr &pSurface, const css::rendering::ViewState &viewState, const css::rendering::RenderState &renderState) override
virtual OutputDevice * getOutputDevice() override
virtual ::cairo::SurfaceSharedPtr getSurface() override
virtual void disposeThis() override
Object is being disposed.
SpriteCanvasRef mpSpriteCanvas
MUST hold here, too, since CanvasHelper only contains a raw pointer (without refcounting)
virtual void redraw(const ::cairo::CairoSharedPtr &pCairo, const ::basegfx::B2DPoint &rOrigOutputPos, bool bBufferedUpdate) const override
CanvasCustomSprite(const css::geometry::RealSize2D &rSpriteSize, const SpriteCanvasRef &rRefDevice)
Create a custom sprite.
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual void redraw(const ::cairo::CairoSharedPtr &pCairo, bool bBufferedUpdate) const override
virtual OUString SAL_CALL getImplementationName() override
virtual ::cairo::SurfaceSharedPtr createSurface(const ::basegfx::B2ISize &rSize, int aContent) override
Helper class for canvas sprites.
Specialization of canvas::Sprite interface, to also provide redraw methods.
Base class, initializing its own baseclass with m_aMutex.
Helper template to handle XCustomSprite method forwarding to CanvasCustomSpriteHelper.
std::shared_ptr< Surface > SurfaceSharedPtr
::canvas::CanvasCustomSpriteBase< CanvasCustomSpriteSpriteBase_Base, SpriteHelper, CanvasHelper, ::osl::MutexGuard, ::cppu::OWeakObject > CanvasCustomSpriteBaseT
::cppu::WeakComponentImplHelper< css::rendering::XCustomSprite, css::rendering::XBitmapCanvas, css::rendering::XIntegerBitmap, css::lang::XServiceInfo > CanvasCustomSpriteBase_Base
unsigned char sal_Bool
#define DECLARE_UNO3_XCOMPONENT_AGG_DEFAULTS(classname, baseclass, implhelper)