1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
22 #include <com/sun/star/rendering/XSpriteCanvas.hpp>
23 #include <basegfx/vector/b2dsize.hxx>
24 #include <basegfx/matrix/b2dhommatrix.hxx>
25 #include <cppcanvas/spritecanvas.hxx>
26 #include "implcanvas.hxx"
28 namespace cppcanvas::internal
30 class ImplSpriteCanvas
: public virtual SpriteCanvas
, protected virtual ImplCanvas
33 ImplSpriteCanvas( const css::uno::Reference
<
34 css::rendering::XSpriteCanvas
>& rCanvas
);
35 ImplSpriteCanvas(const ImplSpriteCanvas
&);
37 virtual ~ImplSpriteCanvas() override
;
39 virtual void setTransformation( const ::basegfx::B2DHomMatrix
& rMatrix
) override
;
41 virtual bool updateScreen( bool bUpdateAll
) const override
;
43 virtual CustomSpriteSharedPtr
createCustomSprite( const ::basegfx::B2DSize
& ) const override
;
45 virtual CanvasSharedPtr
clone() const override
;
47 virtual css::uno::Reference
<
48 css::rendering::XSpriteCanvas
> getUNOSpriteCanvas() const override
;
50 /** This class passes the view transformation
53 This helper class is necessary, because the
54 ImplSpriteCanvas object cannot hand out shared ptrs of
55 itself, but has somehow pass an object to child
56 sprites those can query for the canvas' view transform.
58 class TransformationArbiter
61 TransformationArbiter();
63 void setTransformation( const ::basegfx::B2DHomMatrix
& rViewTransform
);
64 const ::basegfx::B2DHomMatrix
& getTransformation() const { return maTransformation
; }
67 ::basegfx::B2DHomMatrix maTransformation
;
70 typedef std::shared_ptr
< TransformationArbiter
> TransformationArbiterSharedPtr
;
73 ImplSpriteCanvas
& operator=( const ImplSpriteCanvas
& ) = delete;
75 const css::uno::Reference
< css::rendering::XSpriteCanvas
> mxSpriteCanvas
;
76 TransformationArbiterSharedPtr mpTransformArbiter
;
80 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */