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 INCLUDED_DRAWINGLAYER_PRIMITIVE2D_MEDIAPRIMITIVE2D_HXX
21 : #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_MEDIAPRIMITIVE2D_HXX
22 :
23 : #include <drawinglayer/drawinglayerdllapi.h>
24 :
25 : #include <drawinglayer/primitive2d/baseprimitive2d.hxx>
26 : #include <basegfx/matrix/b2dhommatrix.hxx>
27 : #include <basegfx/color/bcolor.hxx>
28 : #include <vcl/graph.hxx>
29 :
30 :
31 :
32 : namespace drawinglayer
33 : {
34 : namespace primitive2d
35 : {
36 : /** MediaPrimitive2D class
37 :
38 : This is a unified primitive for Media visualisation, e.g. animations
39 : or sounds. It's geometry is defined by Transform. For conveinience,
40 : it also contains a discrete border size (aka Pixels) which will be added
41 : if used. This makes it a view-dependent primitive. It also gets a filled
42 : background and the decomposition will try to create a graphic representation
43 : if te content (defined by the URL), e.g. a still frome for animated stuff.
44 : */
45 0 : class DRAWINGLAYER_DLLPUBLIC MediaPrimitive2D : public BufferedDecompositionPrimitive2D
46 : {
47 : private:
48 : /// the geometry definition
49 : basegfx::B2DHomMatrix maTransform;
50 :
51 : /// the content definition
52 : OUString maURL;
53 :
54 : /// style: background color
55 : basegfx::BColor maBackgroundColor;
56 :
57 : /// discrete border (in 'pixels')
58 : sal_uInt32 mnDiscreteBorder;
59 :
60 : const Graphic maSnapshot;
61 :
62 : protected:
63 : /// local decomposition
64 : virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const SAL_OVERRIDE;
65 :
66 : public:
67 : /// constructor
68 : MediaPrimitive2D(
69 : const basegfx::B2DHomMatrix& rTransform,
70 : const OUString& rURL,
71 : const basegfx::BColor& rBackgroundColor,
72 : sal_uInt32 nDiscreteBorder,
73 : const Graphic &rSnapshot);
74 :
75 : /// data read access
76 0 : const basegfx::B2DHomMatrix& getTransform() const { return maTransform; }
77 0 : const OUString& getURL() const { return maURL; }
78 0 : const basegfx::BColor& getBackgroundColor() const { return maBackgroundColor; }
79 0 : sal_uInt32 getDiscreteBorder() const { return mnDiscreteBorder; }
80 :
81 : /// compare operator
82 : virtual bool operator==(const BasePrimitive2D& rPrimitive) const SAL_OVERRIDE;
83 :
84 : /// get range
85 : virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const SAL_OVERRIDE;
86 :
87 : /// provide unique ID
88 : DeclPrimitive2DIDBlock()
89 : };
90 : } // end of namespace primitive2d
91 : } // end of namespace drawinglayer
92 :
93 :
94 :
95 : #endif // INCLUDED_DRAWINGLAYER_PRIMITIVE2D_MEDIAPRIMITIVE2D_HXX
96 :
97 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|