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_GROUPPRIMITIVE2D_HXX
21 : #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_GROUPPRIMITIVE2D_HXX
22 :
23 : #include <drawinglayer/drawinglayerdllapi.h>
24 :
25 : #include <drawinglayer/primitive2d/baseprimitive2d.hxx>
26 :
27 :
28 : // GroupPrimitive2D class
29 :
30 : namespace drawinglayer
31 : {
32 : namespace primitive2d
33 : {
34 : /** GroupPrimitive2D class
35 :
36 : Baseclass for all grouping 2D primitives
37 :
38 : The grouping primitive in it's basic form is capable of holding
39 : a child primitive content and returns it on decomposition on default.
40 : It is used for two main purposes, but more may apply:
41 :
42 : - to transport extended information, e.g. for text classification,
43 : see e.g. TextHierarchy*Primitive2D implementations. Since they
44 : decompose to their child content, renderers not aware/interested
45 : in that extra information will just ignore these primitives
46 :
47 : - to encapsulate common geometry, e.g. the ShadowPrimitive2D implements
48 : applying a generic shadow to a child sequence by adding the needed
49 : offset and color stuff in the decomposition
50 :
51 : In most cases the decomposition is straightforward, so by default
52 : this primitive will not buffer the result and is not derived from
53 : BufferedDecompositionPrimitive2D, but from BasePrimitive2D.
54 :
55 : A renderer has to take GroupPrimitive2D derivations into account which
56 : are used to hold a state.
57 :
58 : Current Basic 2D StatePrimitives are:
59 :
60 : - TransparencePrimitive2D (objects with freely defined transparence)
61 : - InvertPrimitive2D (for XOR)
62 : - MaskPrimitive2D (for masking)
63 : - ModifiedColorPrimitive2D (for a stack of color modifications)
64 : - TransformPrimitive2D (for a transformation stack)
65 : */
66 168700 : class DRAWINGLAYER_DLLPUBLIC GroupPrimitive2D : public BasePrimitive2D
67 : {
68 : private:
69 : /// the children. Declared private since this shall never be changed at all after construction
70 : Primitive2DSequence maChildren;
71 :
72 : public:
73 : /// constructor
74 : explicit GroupPrimitive2D(const Primitive2DSequence& rChildren);
75 :
76 : /// data read access
77 964760 : const Primitive2DSequence& getChildren() const { return maChildren; }
78 :
79 : /// compare operator
80 : virtual bool operator==( const BasePrimitive2D& rPrimitive ) const SAL_OVERRIDE;
81 :
82 : /// local decomposition. Implementation will just return children
83 : virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const SAL_OVERRIDE;
84 :
85 : /// provide unique ID
86 : DeclPrimitive2DIDBlock()
87 : };
88 : } // end of namespace primitive2d
89 : } // end of namespace drawinglayer
90 :
91 :
92 :
93 : #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_GROUPPRIMITIVE2D_HXX
94 :
95 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|