xref: /AOO41X/main/drawinglayer/inc/drawinglayer/primitive2d/mediaprimitive2d.hxx (revision 4f506f19cd544df9572ed8c88b6bdbc6c8f33210)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_MEDIAPRIMITIVE2D_HXX
25 #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_MEDIAPRIMITIVE2D_HXX
26 
27 #include <drawinglayer/drawinglayerdllapi.h>
28 #include <drawinglayer/primitive2d/baseprimitive2d.hxx>
29 #include <basegfx/matrix/b2dhommatrix.hxx>
30 #include <basegfx/color/bcolor.hxx>
31 
32 //////////////////////////////////////////////////////////////////////////////
33 
34 namespace drawinglayer
35 {
36     namespace primitive2d
37     {
38         /** MediaPrimitive2D class
39 
40             This is a unified primitive for Media visualisation, e.g. animations
41             or sounds. It's geometry is defined by Transform. For conveinience,
42             it also contains a discrete border size (aka Pixels) which will be added
43             if used. This makes it a view-dependent primitive. It also gets a filled
44             background and the decomposition will try to create a graphic representation
45             if te content (defined by the URL), e.g. a still frome for animated stuff.
46          */
47         class DRAWINGLAYER_DLLPUBLIC MediaPrimitive2D : public BufferedDecompositionPrimitive2D
48         {
49         private:
50             /// the geometry definition
51             basegfx::B2DHomMatrix                       maTransform;
52 
53             /// the content definition
54             rtl::OUString                               maURL;
55 
56             /// style: background color
57             basegfx::BColor                             maBackgroundColor;
58 
59             /// discrete border (in 'pixels')
60             sal_uInt32                                  mnDiscreteBorder;
61 
62         protected:
63             /// local decomposition
64             virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
65 
66         public:
67             /// constructor
68             MediaPrimitive2D(
69                 const basegfx::B2DHomMatrix& rTransform,
70                 const rtl::OUString& rURL,
71                 const basegfx::BColor& rBackgroundColor,
72                 sal_uInt32 nDiscreteBorder);
73 
74             /// data read access
getTransform() const75             const basegfx::B2DHomMatrix& getTransform() const { return maTransform; }
getURL() const76             const rtl::OUString& getURL() const { return maURL; }
getBackgroundColor() const77             const basegfx::BColor& getBackgroundColor() const { return maBackgroundColor; }
getDiscreteBorder() const78             sal_uInt32 getDiscreteBorder() const { return mnDiscreteBorder; }
79 
80             /// compare operator
81             virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
82 
83             /// get range
84             virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
85 
86             /// provide unique ID
87             DeclPrimitrive2DIDBlock()
88         };
89     } // end of namespace primitive2d
90 } // end of namespace drawinglayer
91 
92 //////////////////////////////////////////////////////////////////////////////
93 
94 #endif // INCLUDED_DRAWINGLAYER_PRIMITIVE2D_MEDIAPRIMITIVE2D_HXX
95 
96 //////////////////////////////////////////////////////////////////////////////
97 // eof
98