Line data Source code
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 :
25 : class SwTxtNode;
26 : struct SwPosition;
27 : class SwNumRule;
28 : class SwNumFmt;
29 :
30 : class SW_DLLPUBLIC SwNodeNum : public SwNumberTreeNode
31 : {
32 : public:
33 :
34 : explicit SwNodeNum( SwTxtNode* pTxtNode );
35 : explicit SwNodeNum( SwNumRule* pNumRule );
36 : virtual ~SwNodeNum();
37 :
38 344230 : SwNumRule* GetNumRule() const { return mpNumRule;}
39 : void ChangeNumRule( SwNumRule& rNumRule );
40 574721 : SwTxtNode* GetTxtNode() const { return mpTxtNode;}
41 :
42 : virtual bool IsNotificationEnabled() const SAL_OVERRIDE;
43 :
44 : virtual bool IsContinuous() const SAL_OVERRIDE;
45 :
46 : virtual bool IsCounted() const SAL_OVERRIDE;
47 :
48 : virtual bool LessThan(const SwNumberTreeNode & rNode) const SAL_OVERRIDE;
49 :
50 : virtual bool IsRestart() const SAL_OVERRIDE;
51 :
52 : virtual SwNumberTree::tSwNumTreeNumber GetStartValue() const SAL_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 :
65 : /** determines the <SwNodeNum> instance, which is preceding the given text node
66 :
67 : #i81002#
68 :
69 : @author OD
70 : */
71 : const SwNodeNum* GetPrecedingNodeNumOf( const SwTxtNode& rTxtNode ) const;
72 :
73 : protected:
74 : virtual SwNumberTreeNode * Create() const SAL_OVERRIDE;
75 :
76 : // --> #i64010#
77 : virtual bool HasCountedChildren() const SAL_OVERRIDE;
78 : virtual bool IsCountedForNumbering() const SAL_OVERRIDE;
79 :
80 : // method called before this tree node has been added to the list tree
81 : virtual void PreAdd() SAL_OVERRIDE;
82 : // method called at a child after this child has been removed from the list tree
83 : virtual void PostRemove() SAL_OVERRIDE;
84 : private:
85 : SwTxtNode * mpTxtNode;
86 : SwNumRule * mpNumRule;
87 :
88 : static void _UnregisterMeAndChildrenDueToRootDelete( SwNodeNum& rNodeNum );
89 :
90 : SwNodeNum( const SwNodeNum& ); // no copy constructor
91 : SwNodeNum& operator=( const SwNodeNum& ); // no assignment operator
92 :
93 : virtual bool IsCountPhantoms() const SAL_OVERRIDE;
94 :
95 : virtual bool IsNotifiable() const SAL_OVERRIDE;
96 :
97 : virtual void NotifyNode() SAL_OVERRIDE;
98 : };
99 :
100 : #endif // INCLUDED_SW_INC_SWNODENUM_HXX
101 :
102 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|