xref: /aoo41x/main/sw/inc/SwNodeNum.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef _SW_NODE_NUM_HXX
29 #define _SW_NODE_NUM_HXX
30 
31 #include <SwNumberTree.hxx>
32 
33 class SwTxtNode;
34 struct SwPosition;
35 class SwNumRule;
36 class SwNumFmt;
37 
38 class SW_DLLPUBLIC SwNodeNum : public SwNumberTreeNode
39 {
40 public:
41     // --> OD 2008-02-19 #refactorlists#
42     explicit SwNodeNum( SwTxtNode* pTxtNode );
43     explicit SwNodeNum( SwNumRule* pNumRule );
44     // <--
45     virtual ~SwNodeNum();
46 
47     SwNumRule* GetNumRule() const;
48     void ChangeNumRule( SwNumRule& rNumRule );
49     SwTxtNode* GetTxtNode() const;
50 
51     virtual bool IsNotificationEnabled() const;
52 
53     virtual bool IsContinuous() const;
54 
55     virtual bool IsCounted() const;
56 
57     virtual bool LessThan(const SwNumberTreeNode & rNode) const;
58 
59     virtual bool IsRestart() const;
60 
61     virtual SwNumberTree::tSwNumTreeNumber GetStartValue() const;
62 
63 //    String ToString() const;
64 
65     SwPosition GetPosition() const;
66 
67     // --> OD 2006-03-07 #131436#
68     // The number tree root node is deleted, when the corresponding numbering
69     // rule is deleted. In this situation the number tree should be empty -
70     // still registered text nodes aren't allowed. But it is possible, that
71     // text nodes of the undo nodes array are still registered. These will be
72     // unregistered.
73     // Text nodes of the document nodes array aren't allowed to be registered
74     // in this situation - this will be asserted.
75     static void HandleNumberTreeRootNodeDelete( SwNodeNum& rNodeNum );
76     // <--
77 
78     /** determines the <SwNodeNum> instance, which is preceding the given text node
79 
80         OD 2007-09-06 #i81002#
81 
82         @author OD
83     */
84     const SwNodeNum* GetPrecedingNodeNumOf( const SwTxtNode& rTxtNode ) const;
85 
86 protected:
87     virtual SwNumberTreeNode * Create() const;
88 
89     // --> OD 2006-04-26 #i64010#
90     virtual bool HasCountedChildren() const;
91     virtual bool IsCountedForNumbering() const;
92     // <--
93 
94     // --> OD 2008-02-19 #refactorlists#
95     // method called before this tree node has been added to the list tree
96     virtual void PreAdd();
97     // method called at a child after this child has been removed from the list tree
98     virtual void PostRemove();
99     // <--
100 private:
101     SwTxtNode * mpTxtNode;
102     SwNumRule * mpNumRule;
103 
104     // --> OD 2006-03-07 #131436#
105     static void _UnregisterMeAndChildrenDueToRootDelete( SwNodeNum& rNodeNum );
106     // <--
107 
108     SwNodeNum( const SwNodeNum& );              // no copy constructor
109     SwNodeNum& operator=( const SwNodeNum& );   // no assignment operator
110 
111     virtual bool IsCountPhantoms() const;
112 
113     virtual bool IsNotifiable() const;
114 
115     virtual void NotifyNode();
116 };
117 
118 #endif // _SW_NODE_NUM_HXX
119