Debian Codegraph @

cppcanvas/source/wrapper/implspritecanvas.hxx

raw
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
22 #include <com/sun/star/rendering/XSpriteCanvas.hpp>
23 #include <basegfx/matrix/b2dhommatrix.hxx>
24 #include <cppcanvas/spritecanvas.hxx>
25 #include "implcanvas.hxx"
26
27 namespace cppcanvas::internal
28 {
29 class ImplSpriteCanvas : public virtual SpriteCanvas, protected virtual ImplCanvas
30 {
31 public:
32 ImplSpriteCanvas( const css::uno::Reference<
33 css::rendering::XSpriteCanvas >& rCanvas );
34 ImplSpriteCanvas(const ImplSpriteCanvas&);
35
36 virtual ~ImplSpriteCanvas() override;
37
38 virtual void setTransformation( const ::basegfx::B2DHomMatrix& rMatrix ) override;
39
40 virtual bool updateScreen( bool bUpdateAll ) const override;
41
42 virtual CustomSpriteSharedPtr createCustomSprite( const ::basegfx::B2DSize& ) const override;
43
44 virtual CanvasSharedPtr clone() const override;
45
46 virtual css::uno::Reference<
47 css::rendering::XSpriteCanvas > getUNOSpriteCanvas() const override;
48
49 /** This class passes the view transformation
50 to child sprites
51
52 This helper class is necessary, because the
53 ImplSpriteCanvas object cannot hand out shared ptrs of
54 itself, but has somehow pass an object to child
55 sprites those can query for the canvas' view transform.
56 */
57 class TransformationArbiter
58 {
59 public:
60 TransformationArbiter();
61
62 void setTransformation( const ::basegfx::B2DHomMatrix& rViewTransform );
63 const ::basegfx::B2DHomMatrix& getTransformation() const { return maTransformation; }
64
65 private:
66 ::basegfx::B2DHomMatrix maTransformation;
67 };
68
69 typedef std::shared_ptr< TransformationArbiter > TransformationArbiterSharedPtr;
70
71 private:
72 ImplSpriteCanvas& operator=( const ImplSpriteCanvas& ) = delete;
73
74 const css::uno::Reference< css::rendering::XSpriteCanvas > mxSpriteCanvas;
75 TransformationArbiterSharedPtr mpTransformArbiter;
76 };
77 }
78
79 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */