1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: rscclobj.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_rsc.hxx"
33 /****************** I N C L U D E S **************************************/
35 // C and C++ Includes.
38 #include <tools/solar.h>
40 // Programmabhaengige Includes.
41 #include <rscclobj.hxx>
44 /****************** C O D E **********************************************/
46 /****************** R e f N o d e ****************************************/
47 /*************************************************************************
52 |* Ersterstellung MM 03.05.91
53 |* Letzte Aenderung MM 03.05.91
55 *************************************************************************/
56 RefNode::RefNode( Atom nTyp
){
61 /*************************************************************************
66 |* Ersterstellung MM 29.10.91
67 |* Letzte Aenderung MM 29.10.91
69 *************************************************************************/
70 sal_uInt32
RefNode::GetId() const
75 /*************************************************************************
77 |* RefNode::PutObjNode()
79 |* Beschreibung NAME.DOC
80 |* Ersterstellung MM 21.03.90
81 |* Letzte Aenderung MM 27.06.90
83 *************************************************************************/
84 BOOL
RefNode::PutObjNode( ObjNode
* pPutObject
){
85 // insert a node in the b-tree pObjBiTree
86 // if the node with the same name is in pObjBiTree,
87 // return FALSE and no insert,
90 return( pObjBiTree
->Insert( pPutObject
) );
92 pObjBiTree
= pPutObject
;
96 /****************** O b j N o d e ****************************************/
97 /*************************************************************************
99 |* RefNode::GetObjNode()
101 |* Beschreibung NAME.DOC
102 |* Ersterstellung MM 21.03.90
103 |* Letzte Aenderung MM 27.06.90
105 *************************************************************************/
106 ObjNode
* RefNode :: GetObjNode( const RscId
& rRscId
){
107 // insert a node in the b-tree pObjBiTree
108 // if the node with the same name is in pObjBiTree,
109 // return NULL and no insert,
110 // if not return the pointer to the Object
113 return( pObjBiTree
->Search( rRscId
) );
117 /*************************************************************************
119 |* ObjNode::ObjNode()
122 |* Ersterstellung MM 15.05.91
123 |* Letzte Aenderung MM 15.05.91
125 *************************************************************************/
126 ObjNode::ObjNode( const RscId
& rId
, CLASS_DATA pData
, ULONG lKey
){
132 /*************************************************************************
134 |* ObjNode::DelObjNode()
137 |* Ersterstellung MM 09.12.91
138 |* Letzte Aenderung MM 09.12.91
140 *************************************************************************/
141 ObjNode
* ObjNode::DelObjNode( RscTop
* pClass
, ULONG nFileKey
){
142 ObjNode
* pRetNode
= this;
145 pRight
= ((ObjNode
*)Right())->DelObjNode( pClass
, nFileKey
);
147 pLeft
= ((ObjNode
*)Left())->DelObjNode( pClass
, nFileKey
);
149 if( GetFileKey() == nFileKey
){
151 pClass
->Destroy( RSCINST( pClass
, GetRscObj() ) );
152 rtl_freeMemory( GetRscObj() );
154 pRetNode
= (ObjNode
*)Right();
157 pRetNode
->Insert( (ObjNode
*)Left() );
160 pRetNode
= (ObjNode
*)Left();
166 /*************************************************************************
171 |* Ersterstellung MM 29.10.91
172 |* Letzte Aenderung MM 29.10.91
174 *************************************************************************/
175 sal_uInt32
ObjNode::GetId() const
177 return( (sal_uInt32
)(long)aRscId
);
180 /*************************************************************************
182 |* ObjNode::IsConsistent()
185 |* Ersterstellung MM 23.09.91
186 |* Letzte Aenderung MM 23.09.91
188 *************************************************************************/
189 BOOL
ObjNode::IsConsistent( RscInconsList
* pList
)
193 if( (long)aRscId
> 0x7FFF || (long)aRscId
< 1 )
197 pList
->Insert( new RscInconsistent( aRscId
, aRscId
) );
203 if( !((ObjNode
*)Left())->IsConsistent( pList
) )
205 if( ((ObjNode
*)Left())->aRscId
>= aRscId
)
210 new RscInconsistent( ((ObjNode
*)Left())->GetRscId(),
216 if( ((ObjNode
*)Right())->aRscId
<= aRscId
)
221 new RscInconsistent( GetRscId(),
222 ((ObjNode
*)Right())->GetRscId() ) );
224 if( !((ObjNode
*)Right())->IsConsistent( pList
) )