Coverage Report

Created: 2026-04-09 11:41

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/drawinglayer/source/processor2d/objectinfoextractor2d.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/processor2d/objectinfoextractor2d.hxx>
21
#include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx>
22
#include <drawinglayer/primitive2d/objectinfoprimitive2d.hxx>
23
24
namespace drawinglayer::processor2d
25
{
26
        void ObjectInfoPrimitiveExtractor2D::processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate)
27
168
        {
28
168
            if(mpFound)
29
0
                return;
30
31
168
            switch(rCandidate.getPrimitive2DID())
32
168
            {
33
0
                case PRIMITIVE2D_ID_OBJECTINFOPRIMITIVE2D :
34
0
                {
35
0
                    mpFound = dynamic_cast< const primitive2d::ObjectInfoPrimitive2D* >(&rCandidate);
36
0
                    break;
37
0
                }
38
168
                default :
39
168
                {
40
                    // we look for an encapsulated primitive, so do not decompose primitives
41
                    // based on GroupPrimitive2D, just visit their children. It may be that more
42
                    // group-like primitives need to be added here, but all primitives with
43
                    // grouping functionality should be implemented based on the GroupPrimitive2D
44
                    // class and have their main content accessible as children
45
168
                    const primitive2d::GroupPrimitive2D* pGroupPrimitive2D = dynamic_cast< const primitive2d::GroupPrimitive2D* >(&rCandidate);
46
47
168
                    if(pGroupPrimitive2D)
48
0
                    {
49
                        // process group children recursively
50
0
                        process(pGroupPrimitive2D->getChildren());
51
0
                    }
52
168
                    else
53
168
                    {
54
                        // do not process recursively, we *only* want to find existing
55
                        // ObjectInfoPrimitive2D entries
56
168
                    }
57
58
168
                    break;
59
0
                }
60
168
            }
61
168
        }
62
63
        ObjectInfoPrimitiveExtractor2D::ObjectInfoPrimitiveExtractor2D(const geometry::ViewInformation2D& rViewInformation)
64
168
        :   BaseProcessor2D(rViewInformation),
65
168
            mpFound(nullptr)
66
168
        {
67
168
        }
68
69
        ObjectInfoPrimitiveExtractor2D::~ObjectInfoPrimitiveExtractor2D()
70
168
        {
71
168
        }
72
73
} // end of namespace
74
75
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */