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