xref: /trunk/main/drawinglayer/inc/drawinglayer/primitive2d/graphicprimitive2d.hxx (revision 914d351e5f5b84e4342a86d6ab8d4aca7308b9bd)
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_GRAPHICPRIMITIVE2D_HXX
25 #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_GRAPHICPRIMITIVE2D_HXX
26 
27 #include <drawinglayer/drawinglayerdllapi.h>
28 #include <drawinglayer/primitive2d/baseprimitive2d.hxx>
29 #include <basegfx/matrix/b2dhommatrix.hxx>
30 #include <svtools/grfmgr.hxx>
31 
32 //////////////////////////////////////////////////////////////////////////////
33 
34 namespace drawinglayer
35 {
36     namespace primitive2d
37     {
38         /** GraphicPrimitive2D class
39 
40             Primitive to hold graphics defined by GraphicObject and GraphicAttr
41             combination. This includes MetaFiles and diverse pixel-oriented graphic
42             formats. It even includes animated GIFs, Croppings and other changes
43             defined in GraphicAttr.
44 
45             This makes the decomposition contain a wide variety of possibilities,
46             too. From a simple BitmapPrimitive over AnimatedSwitchPrimitive2D,
47             MetafilePrimitive2D (with and without embedding in a masking when e.g.
48             the Metafile is bigger than the geometry) and embeddings in
49             TransformPrimitive2D and MaskPrimitive2D for croppings.
50 
51             The primitive geometry area is defined by Transform.
52          */
53         class DRAWINGLAYER_DLLPUBLIC GraphicPrimitive2D : public BufferedDecompositionPrimitive2D
54         {
55         private:
56             /// the geometric definition
57             basegfx::B2DHomMatrix                       maTransform;
58 
59             /// the GraphicObject with all it's content possibilities
60             GraphicObject                               maGraphicObject;
61 
62             /// The GraphicAttr with all it's modification possibilities
63             GraphicAttr                                 maGraphicAttr;
64 
65         protected:
66             /// local decomposition
67             virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
68 
69         public:
70             /// constructor(s)
71             GraphicPrimitive2D(
72                 const basegfx::B2DHomMatrix& rTransform,
73                 const GraphicObject& rGraphicObject,
74                 const GraphicAttr& rGraphicAttr);
75             GraphicPrimitive2D(
76                 const basegfx::B2DHomMatrix& rTransform,
77                 const GraphicObject& rGraphicObject);
78 
79             /// data read access
getTransform() const80             const basegfx::B2DHomMatrix& getTransform() const { return maTransform; }
getGraphicObject() const81             const GraphicObject& getGraphicObject() const { return maGraphicObject; }
getGraphicAttr() const82             const GraphicAttr& getGraphicAttr() const { return maGraphicAttr; }
83             bool isTransparent() const;
84 
85             /// compare operator
86             virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
87 
88             /// get range
89             virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
90 
91             /// provide unique ID
92             DeclPrimitrive2DIDBlock()
93         };
94     } // end of namespace primitive2d
95 } // end of namespace drawinglayer
96 
97 //////////////////////////////////////////////////////////////////////////////
98 
99 #endif // INCLUDED_DRAWINGLAYER_PRIMITIVE2D_GRAPHICPRIMITIVE2D_HXX
100 
101 //////////////////////////////////////////////////////////////////////////////
102 // eof
103