Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / include / drawinglayer / primitive2d / groupprimitive2d.hxx
bloba38c28d4657c02fe9c0fa7a97e8262f620586797
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_GROUPPRIMITIVE2D_HXX
21 #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_GROUPPRIMITIVE2D_HXX
23 #include <drawinglayer/drawinglayerdllapi.h>
25 #include <drawinglayer/primitive2d/baseprimitive2d.hxx>
28 // GroupPrimitive2D class
30 namespace drawinglayer
32 namespace primitive2d
34 /** GroupPrimitive2D class
36 Baseclass for all grouping 2D primitives
38 The grouping primitive in its 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:
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
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
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.
55 A renderer has to take GroupPrimitive2D derivations into account which
56 are used to hold a state.
58 Current Basic 2D StatePrimitives are:
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)
66 class DRAWINGLAYER_DLLPUBLIC GroupPrimitive2D : public BasePrimitive2D
68 private:
69 /// the children. Declared private since this shall never be changed at all after construction
70 Primitive2DContainer maChildren;
72 public:
73 /// constructor
74 explicit GroupPrimitive2D(const Primitive2DContainer& rChildren);
76 /// data read access
77 const Primitive2DContainer& getChildren() const { return maChildren; }
79 void getChildren(Primitive2DDecompositionVisitor& rVisitor) const { rVisitor.append(maChildren); }
81 /// compare operator
82 virtual bool operator==( const BasePrimitive2D& rPrimitive ) const override;
84 /// local decomposition. Implementation will just return children
85 virtual void get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const override;
87 /// provide unique ID
88 DeclPrimitive2DIDBlock()
90 // XAccounting
91 virtual sal_Int64 SAL_CALL estimateUsage() override;
93 } // end of namespace primitive2d
94 } // end of namespace drawinglayer
97 #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_GROUPPRIMITIVE2D_HXX
99 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */