Coverage Report

Created: 2026-03-31 11:00

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/sw/inc/SwNodeNum.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
#pragma once
20
21
#include "SwNumberTree.hxx"
22
23
class SwTextNode;
24
struct SwPosition;
25
class SwNumRule;
26
27
class SAL_DLLPUBLIC_RTTI SwNodeNum final : public SwNumberTreeNode
28
{
29
public:
30
    explicit SwNodeNum(SwTextNode* pTextNode, bool isHiddenRedlines);
31
    // note: this is only for creating phantom nodes and root nodes; these
32
    // never have a text node
33
    explicit SwNodeNum(SwNumRule* pNumRule);
34
    virtual ~SwNodeNum() override;
35
36
45.0M
    SwNumRule* GetNumRule() const { return mpNumRule; }
37
    void ChangeNumRule(SwNumRule& rNumRule);
38
55.3M
    SwTextNode* GetTextNode() const { return mpTextNode; }
39
40
    virtual bool IsNotificationEnabled(const SwDoc& rDoc) const override;
41
42
    virtual bool IsContinuous() const override;
43
44
    virtual bool IsCounted() const override;
45
46
    virtual bool LessThan(const SwNumberTreeNode& rNode) const override;
47
48
    virtual bool IsRestart() const override;
49
50
    virtual SwNumberTree::tSwNumTreeNumber GetStartValue() const override;
51
52
    SwPosition GetPosition() const;
53
54
    // The number tree root node is deleted, when the corresponding numbering
55
    // rule is deleted. In this situation the number tree should be empty -
56
    // still registered text nodes aren't allowed. But it is possible, that
57
    // text nodes of the undo nodes array are still registered. These will be
58
    // unregistered.
59
    // Text nodes of the document nodes array aren't allowed to be registered
60
    // in this situation - this will be asserted.
61
    static void HandleNumberTreeRootNodeDelete(SwNodeNum& rNodeNum);
62
63
    /** determines the <SwNodeNum> instance, which is preceding the given text node
64
65
        #i81002#
66
    */
67
    const SwNodeNum* GetPrecedingNodeNumOf(const SwTextNode& rTextNode) const;
68
69
private:
70
    virtual SwNumberTreeNode* Create() const override;
71
72
    // --> #i64010#
73
    virtual bool HasCountedChildren() const override;
74
    virtual bool IsCountedForNumbering() const override;
75
76
    // method called before this tree node has been added to the list tree
77
    virtual void PreAdd() override;
78
    // method called at a child after this child has been removed from the list tree
79
    virtual void PostRemove() override;
80
81
    SwTextNode* const mpTextNode;
82
    SwNumRule* mpNumRule;
83
    bool m_isHiddenRedlines;
84
85
    static void UnregisterMeAndChildrenDueToRootDelete(SwNodeNum& rNodeNum);
86
87
    SwNodeNum(const SwNodeNum&) = delete;
88
    SwNodeNum& operator=(const SwNodeNum&) = delete;
89
90
    virtual bool IsCountPhantoms() const override;
91
92
    virtual bool IsNotifiable(const SwDoc& rDoc) const override;
93
94
    virtual void NotifyNode() override;
95
};
96
97
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */