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