LibreOffice Module cppcanvas (master) 1
implspritecanvas.cxx
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
22#include <osl/diagnose.h>
23
24#include "implspritecanvas.hxx"
25#include "implcustomsprite.hxx"
26
27
28using namespace ::com::sun::star;
29
30namespace cppcanvas::internal
31{
34 {
35 }
36
37 void ImplSpriteCanvas::TransformationArbiter::setTransformation( const ::basegfx::B2DHomMatrix& rViewTransform )
38 {
39 maTransformation = rViewTransform;
40 }
41
42
43 ImplSpriteCanvas::ImplSpriteCanvas( const uno::Reference< rendering::XSpriteCanvas >& rCanvas ) :
44 ImplCanvas( rCanvas ),
45 mxSpriteCanvas( rCanvas ),
47 {
48 OSL_ENSURE( mxSpriteCanvas.is(), "ImplSpriteCanvas::ImplSpriteCanvas(): Invalid canvas" );
49 }
50
52 Canvas(),
54 ImplCanvas( rOrig ),
57 {
58 OSL_ENSURE( mxSpriteCanvas.is(), "ImplSpriteCanvas::ImplSpriteCanvas( const ImplSpriteCanvas& ): Invalid canvas" );
59
60 mpTransformArbiter->setTransformation( getTransformation() );
61 }
62
64 {
65 }
66
67 void ImplSpriteCanvas::setTransformation( const ::basegfx::B2DHomMatrix& rMatrix )
68 {
69 mpTransformArbiter->setTransformation( rMatrix );
70
72 }
73
74 bool ImplSpriteCanvas::updateScreen( bool bUpdateAll ) const
75 {
76 OSL_ENSURE( mxSpriteCanvas.is(), "ImplSpriteCanvas::updateScreen(): Invalid canvas" );
77
78 if( !mxSpriteCanvas.is() )
79 return false;
80
81 return mxSpriteCanvas->updateScreen( bUpdateAll );
82 }
83
84 CustomSpriteSharedPtr ImplSpriteCanvas::createCustomSprite( const ::basegfx::B2DSize& rSize ) const
85 {
86 OSL_ENSURE( mxSpriteCanvas.is(), "ImplSpriteCanvas::createCustomSprite(): Invalid canvas" );
87
88 if( !mxSpriteCanvas.is() )
89 return CustomSpriteSharedPtr();
90
91 return std::make_shared<ImplCustomSprite>( mxSpriteCanvas,
92 mxSpriteCanvas->createCustomSprite( ::basegfx::unotools::size2DFromB2DSize(rSize) ),
94 }
95
97 {
98 return std::make_shared<ImplSpriteCanvas>( *this );
99 }
100
101 uno::Reference< rendering::XSpriteCanvas > ImplSpriteCanvas::getUNOSpriteCanvas() const
102 {
103 return mxSpriteCanvas;
104 }
105
106}
107
108/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Canvas interface.
Definition: canvas.hxx:55
SpriteCanvas interface.
virtual ::basegfx::B2DHomMatrix getTransformation() const override
Definition: implcanvas.cxx:55
virtual void setTransformation(const ::basegfx::B2DHomMatrix &rMatrix) override
Definition: implcanvas.cxx:50
This class passes the view transformation to child sprites.
void setTransformation(const ::basegfx::B2DHomMatrix &rViewTransform)
TransformationArbiterSharedPtr mpTransformArbiter
const css::uno::Reference< css::rendering::XSpriteCanvas > mxSpriteCanvas
virtual void setTransformation(const ::basegfx::B2DHomMatrix &rMatrix) override
virtual bool updateScreen(bool bUpdateAll) const override
ImplSpriteCanvas(const css::uno::Reference< css::rendering::XSpriteCanvas > &rCanvas)
virtual CustomSpriteSharedPtr createCustomSprite(const ::basegfx::B2DSize &) const override
virtual CanvasSharedPtr clone() const override
virtual css::uno::Reference< css::rendering::XSpriteCanvas > getUNOSpriteCanvas() const override
::basegfx::B2DHomMatrix maTransformation
std::shared_ptr< ::cppcanvas::CustomSprite > CustomSpriteSharedPtr
std::shared_ptr< Canvas > CanvasSharedPtr
std::shared_ptr< T > make_shared(Args &&... args)