/src/libreoffice/drawinglayer/source/primitive2d/groupprimitive2d.cxx
Line | Count | Source |
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 | | #include <drawinglayer/primitive2d/groupprimitive2d.hxx> |
21 | | #include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx> |
22 | | |
23 | | |
24 | | using namespace com::sun::star; |
25 | | |
26 | | |
27 | | namespace drawinglayer::primitive2d |
28 | | { |
29 | | GroupPrimitive2D::GroupPrimitive2D( Primitive2DContainer&& aChildren ) |
30 | 9.80k | : maChildren(std::move(aChildren)) |
31 | 9.80k | { |
32 | 9.80k | } |
33 | | |
34 | | /** The compare operator uses the Sequence::==operator, so only checking if |
35 | | the references are equal. All non-equal references are interpreted as |
36 | | non-equal. |
37 | | */ |
38 | | bool GroupPrimitive2D::operator==( const BasePrimitive2D& rPrimitive ) const |
39 | 0 | { |
40 | 0 | if(BasePrimitive2D::operator==(rPrimitive)) |
41 | 0 | { |
42 | 0 | const GroupPrimitive2D& rCompare = static_cast< const GroupPrimitive2D& >(rPrimitive); |
43 | |
|
44 | 0 | return getChildren() == rCompare.getChildren(); |
45 | 0 | } |
46 | | |
47 | 0 | return false; |
48 | 0 | } |
49 | | |
50 | | /// default: just return children, so all renderers not supporting group will use its content |
51 | | void GroupPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& /*rViewInformation*/) const |
52 | 14.2k | { |
53 | 14.2k | getChildren(rVisitor); |
54 | 14.2k | } |
55 | | |
56 | | sal_Int64 GroupPrimitive2D::estimateUsage() |
57 | 0 | { |
58 | 0 | size_t nRet(0); |
59 | 0 | for (auto& it : getChildren()) |
60 | 0 | { |
61 | 0 | if (it) |
62 | 0 | nRet += it->estimateUsage(); |
63 | 0 | } |
64 | 0 | return nRet; |
65 | 0 | } |
66 | | |
67 | | // provide unique ID |
68 | | sal_uInt32 GroupPrimitive2D::getPrimitive2DID() const |
69 | 6.01k | { |
70 | 6.01k | return PRIMITIVE2D_ID_GROUPPRIMITIVE2D; |
71 | 6.01k | } |
72 | | |
73 | | } // end of namespace |
74 | | |
75 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |