1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
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.
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).
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.
26 ************************************************************************/
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_rsc.hxx"
30 /****************** I N C L U D E S **************************************/
32 // C and C++ Includes.
35 #include <tools/solar.h>
37 // Programmabhaengige Includes.
38 #include <rscclobj.hxx>
41 /****************** C O D E **********************************************/
43 /****************** R e f N o d e ****************************************/
44 /*************************************************************************
49 |* Ersterstellung MM 03.05.91
50 |* Letzte Aenderung MM 03.05.91
52 *************************************************************************/
53 RefNode::RefNode( Atom nTyp
){
58 /*************************************************************************
63 |* Ersterstellung MM 29.10.91
64 |* Letzte Aenderung MM 29.10.91
66 *************************************************************************/
67 sal_uInt32
RefNode::GetId() const
72 /*************************************************************************
74 |* RefNode::PutObjNode()
76 |* Beschreibung NAME.DOC
77 |* Ersterstellung MM 21.03.90
78 |* Letzte Aenderung MM 27.06.90
80 *************************************************************************/
81 sal_Bool
RefNode::PutObjNode( ObjNode
* pPutObject
){
82 // insert a node in the b-tree pObjBiTree
83 // if the node with the same name is in pObjBiTree,
84 // return sal_False and no insert,
87 return( pObjBiTree
->Insert( pPutObject
) );
89 pObjBiTree
= pPutObject
;
93 /****************** O b j N o d e ****************************************/
94 /*************************************************************************
96 |* RefNode::GetObjNode()
98 |* Beschreibung NAME.DOC
99 |* Ersterstellung MM 21.03.90
100 |* Letzte Aenderung MM 27.06.90
102 *************************************************************************/
103 ObjNode
* RefNode :: GetObjNode( const RscId
& rRscId
){
104 // insert a node in the b-tree pObjBiTree
105 // if the node with the same name is in pObjBiTree,
106 // return NULL and no insert,
107 // if not return the pointer to the Object
110 return( pObjBiTree
->Search( rRscId
) );
114 /*************************************************************************
116 |* ObjNode::ObjNode()
119 |* Ersterstellung MM 15.05.91
120 |* Letzte Aenderung MM 15.05.91
122 *************************************************************************/
123 ObjNode::ObjNode( const RscId
& rId
, CLASS_DATA pData
, sal_uLong lKey
){
129 /*************************************************************************
131 |* ObjNode::DelObjNode()
134 |* Ersterstellung MM 09.12.91
135 |* Letzte Aenderung MM 09.12.91
137 *************************************************************************/
138 ObjNode
* ObjNode::DelObjNode( RscTop
* pClass
, sal_uLong nFileKey
){
139 ObjNode
* pRetNode
= this;
142 pRight
= ((ObjNode
*)Right())->DelObjNode( pClass
, nFileKey
);
144 pLeft
= ((ObjNode
*)Left())->DelObjNode( pClass
, nFileKey
);
146 if( GetFileKey() == nFileKey
){
148 pClass
->Destroy( RSCINST( pClass
, GetRscObj() ) );
149 rtl_freeMemory( GetRscObj() );
151 pRetNode
= (ObjNode
*)Right();
154 pRetNode
->Insert( (ObjNode
*)Left() );
157 pRetNode
= (ObjNode
*)Left();
163 /*************************************************************************
168 |* Ersterstellung MM 29.10.91
169 |* Letzte Aenderung MM 29.10.91
171 *************************************************************************/
172 sal_uInt32
ObjNode::GetId() const
174 return( (sal_uInt32
)(long)aRscId
);
177 /*************************************************************************
179 |* ObjNode::IsConsistent()
182 |* Ersterstellung MM 23.09.91
183 |* Letzte Aenderung MM 23.09.91
185 *************************************************************************/
186 sal_Bool
ObjNode::IsConsistent( RscInconsList
* pList
)
188 sal_Bool bRet
= sal_True
;
190 if( (long)aRscId
> 0x7FFF || (long)aRscId
< 1 )
194 pList
->Insert( new RscInconsistent( aRscId
, aRscId
) );
200 if( !((ObjNode
*)Left())->IsConsistent( pList
) )
202 if( ((ObjNode
*)Left())->aRscId
>= aRscId
)
207 new RscInconsistent( ((ObjNode
*)Left())->GetRscId(),
213 if( ((ObjNode
*)Right())->aRscId
<= aRscId
)
218 new RscInconsistent( GetRscId(),
219 ((ObjNode
*)Right())->GetRscId() ) );
221 if( !((ObjNode
*)Right())->IsConsistent( pList
) )