Coverage Report

Created: 2026-05-16 09:25

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/svgio/inc/svgcharacternode.hxx
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
#pragma once
21
22
#include <sal/config.h>
23
#include <rtl/ref.hxx>
24
25
#include <string_view>
26
27
#include <drawinglayer/attribute/fontattribute.hxx>
28
#include "svgtextnode.hxx"
29
#include "svgtextposition.hxx"
30
31
namespace svgio::svgreader
32
    {
33
        class SvgCharacterNode final : public SvgNode
34
        {
35
        private:
36
            /// the string data
37
            OUString           maText;
38
39
            SvgTspanNode*        mpParentLine;
40
41
            bool mbHadTrailingSpace = false;
42
43
            /// local helpers
44
            rtl::Reference<drawinglayer::primitive2d::BasePrimitive2D> createSimpleTextPrimitive(
45
                SvgTextPosition& rSvgTextPosition,
46
                const SvgStyleAttributes& rSvgStyleAttributes) const;
47
            void decomposeTextWithStyle(
48
                drawinglayer::primitive2d::Primitive2DContainer& rTarget,
49
                SvgTextPosition& rSvgTextPosition,
50
                const SvgStyleAttributes& rSvgStyleAttributes) const;
51
52
        public:
53
            SvgCharacterNode(
54
                SvgDocument& rDocument,
55
                SvgNode* pParent,
56
                OUString aText);
57
            virtual ~SvgCharacterNode() override;
58
59
            static drawinglayer::attribute::FontAttribute getFontAttribute(
60
                const SvgStyleAttributes& rSvgStyleAttributes);
61
62
            virtual const SvgStyleAttributes* getSvgStyleAttributes() const override;
63
64
            void decomposeText(drawinglayer::primitive2d::Primitive2DContainer& rTarget, SvgTextPosition& rSvgTextPosition) const;
65
            SvgCharacterNode* whiteSpaceHandling(SvgCharacterNode* pPreviousCharacterNode);
66
            void concatenate(std::u16string_view rText);
67
68
            /// Text content
69
0
            const OUString& getText() const { return maText; }
70
71
0
            void setParentLine(SvgTspanNode* pParentLine) { mpParentLine = pParentLine; }
72
        };
73
74
} // end of namespace svgio::svgreader
75
76
77
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */