LibreOffice Module sw (master) 1
SwNodeNum.hxx
Go to the documentation of this file.
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#ifndef INCLUDED_SW_INC_SWNODENUM_HXX
21#define INCLUDED_SW_INC_SWNODENUM_HXX
22
23#include "SwNumberTree.hxx"
24
25class SwTextNode;
26struct SwPosition;
27class SwNumRule;
28
29class SAL_DLLPUBLIC_RTTI SwNodeNum final : public SwNumberTreeNode
30{
31public:
32 explicit SwNodeNum(SwTextNode* pTextNode, bool isHiddenRedlines);
33 // note: this is only for creating phantom nodes and root nodes; these
34 // never have a text node
35 explicit SwNodeNum(SwNumRule* pNumRule);
36 virtual ~SwNodeNum() override;
37
38 SwNumRule* GetNumRule() const { return mpNumRule; }
39 void ChangeNumRule(SwNumRule& rNumRule);
40 SwTextNode* GetTextNode() const { return mpTextNode; }
41
42 virtual bool IsNotificationEnabled(const SwDoc& rDoc) const override;
43
44 virtual bool IsContinuous() const override;
45
46 virtual bool IsCounted() const override;
47
48 virtual bool LessThan(const SwNumberTreeNode& rNode) const override;
49
50 virtual bool IsRestart() const override;
51
52 virtual SwNumberTree::tSwNumTreeNumber GetStartValue() const override;
53
54 SwPosition GetPosition() const;
55
56 // The number tree root node is deleted, when the corresponding numbering
57 // rule is deleted. In this situation the number tree should be empty -
58 // still registered text nodes aren't allowed. But it is possible, that
59 // text nodes of the undo nodes array are still registered. These will be
60 // unregistered.
61 // Text nodes of the document nodes array aren't allowed to be registered
62 // in this situation - this will be asserted.
63 static void HandleNumberTreeRootNodeDelete(SwNodeNum& rNodeNum);
64
69 const SwNodeNum* GetPrecedingNodeNumOf(const SwTextNode& rTextNode) const;
70
71private:
72 virtual SwNumberTreeNode* Create() const override;
73
74 // --> #i64010#
75 virtual bool HasCountedChildren() const override;
76 virtual bool IsCountedForNumbering() const override;
77
78 // method called before this tree node has been added to the list tree
79 virtual void PreAdd() override;
80 // method called at a child after this child has been removed from the list tree
81 virtual void PostRemove() override;
82
86
87 static void UnregisterMeAndChildrenDueToRootDelete(SwNodeNum& rNodeNum);
88
89 SwNodeNum(const SwNodeNum&) = delete;
90 SwNodeNum& operator=(const SwNodeNum&) = delete;
91
92 virtual bool IsCountPhantoms() const override;
93
94 virtual bool IsNotifiable(const SwDoc& rDoc) const override;
95
96 virtual void NotifyNode() override;
97};
98
99#endif // INCLUDED_SW_INC_SWNODENUM_HXX
100
101/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Definition: doc.hxx:192
SwNumRule * GetNumRule() const
Definition: SwNodeNum.hxx:38
SwTextNode *const mpTextNode
Definition: SwNodeNum.hxx:83
SwNodeNum & operator=(const SwNodeNum &)=delete
SwNumRule * mpNumRule
Definition: SwNodeNum.hxx:84
SwTextNode * GetTextNode() const
Definition: SwNodeNum.hxx:40
SwNodeNum(const SwNodeNum &)=delete
bool m_isHiddenRedlines
Definition: SwNodeNum.hxx:85
A tree of numbered nodes.
virtual bool IsNotifiable(const SwDoc &rDoc) const =0
Return if this node is notifiable.
virtual bool HasCountedChildren() const =0
virtual void PostRemove()=0
virtual bool IsContinuous() const =0
Return if this node is counted continuous.
virtual bool IsNotificationEnabled(const SwDoc &rDoc) const =0
Return if the notification is not disabled on global conditions.
virtual bool IsCounted() const
Return if this node is counted.
virtual bool IsCountedForNumbering() const =0
virtual bool LessThan(const SwNumberTreeNode &rTreeNode) const
Returns if this node is less than another node.
virtual bool IsRestart() const =0
Return if numbering is restarted at this node.
virtual SwNumberTree::tSwNumTreeNumber GetStartValue() const =0
Return start value.
virtual bool IsCountPhantoms() const =0
Return if phantoms are counted.
virtual void NotifyNode()=0
Notifies the node.
virtual SwNumberTreeNode * Create() const =0
Creates a new node of the same class.
virtual void PreAdd()=0
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:89
tools::Long tSwNumTreeNumber
Marks a position in the document model.
Definition: pam.hxx:37