lok: Hide file linking in section
[LibreOffice.git] / sw / inc / SwNodeNum.hxx
bloba29099dbfac427abb917c99bb2f7a10810d1aa8a
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SW_INC_SWNODENUM_HXX
21 #define INCLUDED_SW_INC_SWNODENUM_HXX
23 #include "SwNumberTree.hxx"
25 class SwTextNode;
26 struct SwPosition;
27 class SwNumRule;
29 class SAL_DLLPUBLIC_RTTI SwNodeNum : public SwNumberTreeNode
31 public:
33 explicit SwNodeNum( SwTextNode* pTextNode, bool isHiddenRedlines );
34 // note: this is only for creating phantom nodes and root nodes; these
35 // never have a text node
36 explicit SwNodeNum( SwNumRule* pNumRule );
37 virtual ~SwNodeNum() override;
39 SwNumRule* GetNumRule() const { return mpNumRule;}
40 void ChangeNumRule( SwNumRule& rNumRule );
41 SwTextNode* GetTextNode() const { return mpTextNode;}
43 virtual bool IsNotificationEnabled() const override;
45 virtual bool IsContinuous() const override;
47 virtual bool IsCounted() const override;
49 virtual bool LessThan(const SwNumberTreeNode & rNode) const override;
51 virtual bool IsRestart() const override;
53 virtual SwNumberTree::tSwNumTreeNumber GetStartValue() const override;
55 SwPosition GetPosition() const;
57 // The number tree root node is deleted, when the corresponding numbering
58 // rule is deleted. In this situation the number tree should be empty -
59 // still registered text nodes aren't allowed. But it is possible, that
60 // text nodes of the undo nodes array are still registered. These will be
61 // unregistered.
62 // Text nodes of the document nodes array aren't allowed to be registered
63 // in this situation - this will be asserted.
64 static void HandleNumberTreeRootNodeDelete( SwNodeNum& rNodeNum );
66 /** determines the <SwNodeNum> instance, which is preceding the given text node
68 #i81002#
70 const SwNodeNum* GetPrecedingNodeNumOf( const SwTextNode& rTextNode ) const;
72 protected:
73 virtual SwNumberTreeNode * Create() const override;
75 // --> #i64010#
76 virtual bool HasCountedChildren() const override;
77 virtual bool IsCountedForNumbering() const override;
79 // method called before this tree node has been added to the list tree
80 virtual void PreAdd() override;
81 // method called at a child after this child has been removed from the list tree
82 virtual void PostRemove() override;
83 private:
84 SwTextNode *const mpTextNode;
85 SwNumRule * mpNumRule;
86 bool m_isHiddenRedlines;
88 static void UnregisterMeAndChildrenDueToRootDelete( SwNodeNum& rNodeNum );
90 SwNodeNum( const SwNodeNum& ) = delete;
91 SwNodeNum& operator=( const SwNodeNum& ) = delete;
93 virtual bool IsCountPhantoms() const override;
95 virtual bool IsNotifiable() const override;
97 virtual void NotifyNode() override;
100 #endif // INCLUDED_SW_INC_SWNODENUM_HXX
102 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */