xref: /aoo42x/main/rsc/source/misc/rscdbl.cxx (revision 477794c1)
1*477794c1SAndrew Rist /**************************************************************
2*477794c1SAndrew Rist  *
3*477794c1SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*477794c1SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*477794c1SAndrew Rist  * distributed with this work for additional information
6*477794c1SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*477794c1SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*477794c1SAndrew Rist  * "License"); you may not use this file except in compliance
9*477794c1SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*477794c1SAndrew Rist  *
11*477794c1SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*477794c1SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*477794c1SAndrew Rist  * software distributed under the License is distributed on an
15*477794c1SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*477794c1SAndrew Rist  * KIND, either express or implied.  See the License for the
17*477794c1SAndrew Rist  * specific language governing permissions and limitations
18*477794c1SAndrew Rist  * under the License.
19*477794c1SAndrew Rist  *
20*477794c1SAndrew Rist  *************************************************************/
21*477794c1SAndrew Rist 
22*477794c1SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_rsc.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <stdio.h>
28cdf0e10cSrcweir #include <rscdb.hxx>
29cdf0e10cSrcweir #include <rscall.h>
30cdf0e10cSrcweir #include <rschash.hxx>
31cdf0e10cSrcweir #include <rsctree.hxx>
32cdf0e10cSrcweir #include <rsctop.hxx>
33cdf0e10cSrcweir #include "rsclst.hxx"
34cdf0e10cSrcweir 
35cdf0e10cSrcweir /*************************************************************************
36cdf0e10cSrcweir |*
37cdf0e10cSrcweir |*	  RscTypCont::FillNameIdList()
38cdf0e10cSrcweir |*
39cdf0e10cSrcweir |*	  Beschreibung
40cdf0e10cSrcweir |*	  Ersterstellung	MM 07.05.91
41cdf0e10cSrcweir |*	  Letzte Aenderung	MM 30.05.91
42cdf0e10cSrcweir |*
43cdf0e10cSrcweir *************************************************************************/
InsertList(Atom nClassName,const RscId & rId,REResourceList * pList)44cdf0e10cSrcweir REResourceList * InsertList( Atom nClassName, const RscId& rId,
45cdf0e10cSrcweir 							 REResourceList * pList ){
46cdf0e10cSrcweir 	REResourceList	*	pSubList;
47cdf0e10cSrcweir 	const char *				pStrClass;
48cdf0e10cSrcweir 	ByteString			aStrClass;
49cdf0e10cSrcweir 
50cdf0e10cSrcweir 	pStrClass = pHS->getString( nClassName ).getStr();
51cdf0e10cSrcweir 	if( pStrClass )
52cdf0e10cSrcweir 		aStrClass = pStrClass;
53cdf0e10cSrcweir 	else
54cdf0e10cSrcweir 		aStrClass = ByteString::CreateFromInt32( (long)nClassName );
55cdf0e10cSrcweir 
56cdf0e10cSrcweir 	pSubList = new REResourceList( pList, aStrClass, rId );
57cdf0e10cSrcweir 
58cdf0e10cSrcweir 	pList->Insert( pSubList, 0xFFFFFFFF );
59cdf0e10cSrcweir 	return( pSubList );
60cdf0e10cSrcweir }
61cdf0e10cSrcweir 
FillSubList(RSCINST & rInst,REResourceList * pList)62cdf0e10cSrcweir void FillSubList( RSCINST & rInst, REResourceList * pList )
63cdf0e10cSrcweir {
64cdf0e10cSrcweir 	sal_uInt32		nCount, i;
65cdf0e10cSrcweir 	SUBINFO_STRUCT	aInfo;
66cdf0e10cSrcweir 	REResourceList* pSubList;
67cdf0e10cSrcweir 	RSCINST 		aTmpI;
68cdf0e10cSrcweir 
69cdf0e10cSrcweir 	nCount = rInst.pClass->GetCount( rInst );
70cdf0e10cSrcweir 	for( i = 0; i < nCount; i++ ){
71cdf0e10cSrcweir 		aInfo = rInst.pClass->GetInfoEle( rInst, i );
72cdf0e10cSrcweir 		aTmpI = rInst.pClass->GetPosEle( rInst, i );
73cdf0e10cSrcweir 		pSubList = InsertList( aInfo.pClass->GetId(),
74cdf0e10cSrcweir 							   aInfo.aId, pList );
75cdf0e10cSrcweir 		FillSubList( aTmpI, pSubList );
76cdf0e10cSrcweir 	};
77cdf0e10cSrcweir }
78cdf0e10cSrcweir 
FillListObj(ObjNode * pObjNode,RscTop * pRscTop,REResourceList * pList,sal_uLong lFileKey)79cdf0e10cSrcweir void FillListObj( ObjNode * pObjNode, RscTop * pRscTop,
80cdf0e10cSrcweir 				  REResourceList * pList, sal_uLong lFileKey )
81cdf0e10cSrcweir {
82cdf0e10cSrcweir 	if( pObjNode ){
83cdf0e10cSrcweir 		if( pObjNode->GetFileKey() == lFileKey ){
84cdf0e10cSrcweir 			RSCINST 		aTmpI;
85cdf0e10cSrcweir 			REResourceList* pSubList;
86cdf0e10cSrcweir 
87cdf0e10cSrcweir 			FillListObj( (ObjNode*)pObjNode->Left(), pRscTop,
88cdf0e10cSrcweir 						 pList, lFileKey );
89cdf0e10cSrcweir 
90cdf0e10cSrcweir 			pSubList = InsertList( pRscTop->GetId(),
91cdf0e10cSrcweir 								   pObjNode->GetRscId(), pList );
92cdf0e10cSrcweir 
93cdf0e10cSrcweir 			aTmpI.pClass = pRscTop;
94cdf0e10cSrcweir 			aTmpI.pData = pObjNode->GetRscObj();
95cdf0e10cSrcweir 			FillSubList( aTmpI, pSubList );
96cdf0e10cSrcweir 
97cdf0e10cSrcweir 			FillListObj( (ObjNode*)pObjNode->Right(), pRscTop,
98cdf0e10cSrcweir 						 pList, lFileKey );
99cdf0e10cSrcweir 		}
100cdf0e10cSrcweir 	};
101cdf0e10cSrcweir }
102cdf0e10cSrcweir 
FillList(RscTop * pRscTop,REResourceList * pList,sal_uLong lFileKey)103cdf0e10cSrcweir void FillList( RscTop * pRscTop, REResourceList * pList, sal_uLong lFileKey ){
104cdf0e10cSrcweir 	if( pRscTop ){
105cdf0e10cSrcweir 		FillList( (RscTop*)pRscTop->Left(), pList, lFileKey );
106cdf0e10cSrcweir 
107cdf0e10cSrcweir 		FillListObj( pRscTop->GetObjNode(), pRscTop, pList, lFileKey );
108cdf0e10cSrcweir 
109cdf0e10cSrcweir 		FillList( (RscTop*)pRscTop->Right(), pList, lFileKey );
110cdf0e10cSrcweir 	};
111cdf0e10cSrcweir }
112cdf0e10cSrcweir 
FillNameIdList(REResourceList * pList,sal_uLong lFileKey)113cdf0e10cSrcweir void RscTypCont::FillNameIdList( REResourceList * pList, sal_uLong lFileKey ){
114cdf0e10cSrcweir 	FillList( pRoot, pList, lFileKey );
115cdf0e10cSrcweir }
116