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