1*89b56da7SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3*89b56da7SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*89b56da7SAndrew Rist * or more contributor license agreements. See the NOTICE file
5*89b56da7SAndrew Rist * distributed with this work for additional information
6*89b56da7SAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*89b56da7SAndrew Rist * to you under the Apache License, Version 2.0 (the
8*89b56da7SAndrew Rist * "License"); you may not use this file except in compliance
9*89b56da7SAndrew Rist * with the License. You may obtain a copy of the License at
10*89b56da7SAndrew Rist *
11*89b56da7SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12*89b56da7SAndrew Rist *
13*89b56da7SAndrew Rist * Unless required by applicable law or agreed to in writing,
14*89b56da7SAndrew Rist * software distributed under the License is distributed on an
15*89b56da7SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*89b56da7SAndrew Rist * KIND, either express or implied. See the License for the
17*89b56da7SAndrew Rist * specific language governing permissions and limitations
18*89b56da7SAndrew Rist * under the License.
19*89b56da7SAndrew Rist *
20*89b56da7SAndrew Rist *************************************************************/
21*89b56da7SAndrew Rist
22*89b56da7SAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_tools.hxx"
26cdf0e10cSrcweir #include "tools/geninfo.hxx"
27cdf0e10cSrcweir #include <stdio.h>
28cdf0e10cSrcweir
29cdf0e10cSrcweir //
30cdf0e10cSrcweir // class GenericInformation
31cdf0e10cSrcweir //
32cdf0e10cSrcweir
33cdf0e10cSrcweir /*****************************************************************************/
GenericInformation(const ByteString & rKey,const ByteString & rValue,GenericInformationList * pParentList,GenericInformationList * pSubInfos)34cdf0e10cSrcweir GenericInformation::GenericInformation( const ByteString &rKey,
35cdf0e10cSrcweir const ByteString &rValue,
36cdf0e10cSrcweir GenericInformationList *pParentList,
37cdf0e10cSrcweir GenericInformationList *pSubInfos )
38cdf0e10cSrcweir /*****************************************************************************/
39cdf0e10cSrcweir : ByteString( rKey ),
40cdf0e10cSrcweir sValue( rValue ),
41cdf0e10cSrcweir pInfoList( pSubInfos ),
42cdf0e10cSrcweir pParent( pParentList )
43cdf0e10cSrcweir {
44cdf0e10cSrcweir // if a ParentList exists, insert this object into it
45cdf0e10cSrcweir if ( pParent )
46cdf0e10cSrcweir pParent->InsertInfo( this );
47cdf0e10cSrcweir // make myself owner of pInfoList
48cdf0e10cSrcweir if ( pInfoList )
49cdf0e10cSrcweir pInfoList->SetOwner( this );
50cdf0e10cSrcweir }
51cdf0e10cSrcweir
52cdf0e10cSrcweir /*****************************************************************************/
GenericInformation(const GenericInformation & rInf,sal_Bool bCopySubs)53cdf0e10cSrcweir GenericInformation::GenericInformation( const GenericInformation& rInf,
54cdf0e10cSrcweir sal_Bool bCopySubs)
55cdf0e10cSrcweir /*****************************************************************************/
56cdf0e10cSrcweir : ByteString( rInf ),
57cdf0e10cSrcweir sValue( rInf.sValue ),
58cdf0e10cSrcweir pInfoList( 0L ),
59cdf0e10cSrcweir pParent(NULL)
60cdf0e10cSrcweir {
61cdf0e10cSrcweir if(bCopySubs && rInf.pInfoList)
62cdf0e10cSrcweir pInfoList = new GenericInformationList(*rInf.pInfoList, this);
63cdf0e10cSrcweir }
64cdf0e10cSrcweir
65cdf0e10cSrcweir /*****************************************************************************/
~GenericInformation()66cdf0e10cSrcweir GenericInformation::~GenericInformation()
67cdf0e10cSrcweir /*****************************************************************************/
68cdf0e10cSrcweir {
69cdf0e10cSrcweir // remove pInfoList and all childs out of memory
70cdf0e10cSrcweir delete pInfoList;
71cdf0e10cSrcweir pInfoList = 0;
72cdf0e10cSrcweir
73cdf0e10cSrcweir // remove this Info out of ParentList
74cdf0e10cSrcweir if ( pParent )
75cdf0e10cSrcweir pParent->RemoveInfo( this );
76cdf0e10cSrcweir }
77cdf0e10cSrcweir
78cdf0e10cSrcweir /*****************************************************************************/
InsertSubInfo(GenericInformation * pInfo)79cdf0e10cSrcweir sal_Bool GenericInformation::InsertSubInfo( GenericInformation *pInfo )
80cdf0e10cSrcweir /*****************************************************************************/
81cdf0e10cSrcweir {
82cdf0e10cSrcweir return ( pInfoList && pInfoList->InsertInfo( pInfo ));
83cdf0e10cSrcweir }
84cdf0e10cSrcweir
85cdf0e10cSrcweir /*****************************************************************************/
InsertSubInfo(const ByteString & rPathKey,const ByteString & rValue,sal_Bool bSearchByPath,sal_Bool bNewPath)86cdf0e10cSrcweir sal_Bool GenericInformation::InsertSubInfo( const ByteString &rPathKey, const ByteString &rValue,
87cdf0e10cSrcweir sal_Bool bSearchByPath, sal_Bool bNewPath )
88cdf0e10cSrcweir /*****************************************************************************/
89cdf0e10cSrcweir {
90cdf0e10cSrcweir return (pInfoList && pInfoList->InsertInfo( rPathKey, rValue, bSearchByPath, bNewPath ));
91cdf0e10cSrcweir }
92cdf0e10cSrcweir
93cdf0e10cSrcweir /*****************************************************************************/
RemoveSubInfo(GenericInformation * pInfo,sal_Bool bDelete)94cdf0e10cSrcweir void GenericInformation::RemoveSubInfo( GenericInformation *pInfo,
95cdf0e10cSrcweir sal_Bool bDelete )
96cdf0e10cSrcweir /*****************************************************************************/
97cdf0e10cSrcweir {
98cdf0e10cSrcweir pInfoList->RemoveInfo( pInfo, bDelete );
99cdf0e10cSrcweir }
100cdf0e10cSrcweir
101cdf0e10cSrcweir /*****************************************************************************/
102cdf0e10cSrcweir //void GenericInformation::RemoveSelf( sal_Bool bDelete )
103cdf0e10cSrcweir /*****************************************************************************/
104cdf0e10cSrcweir /*{
105cdf0e10cSrcweir if ( pParent )
106cdf0e10cSrcweir pParent->RemoveInfo( this, bDelete ); // loescht sich aus der Liste vom Parent und
107cdf0e10cSrcweir // bei Bedarf auch mit obiger Methode alle Sublisten
108cdf0e10cSrcweir
109cdf0e10cSrcweir // loescht sich bei Bedarf auch selbst
110cdf0e10cSrcweir if ( bDelete )
111cdf0e10cSrcweir delete this;
112cdf0e10cSrcweir }
113cdf0e10cSrcweir */
114cdf0e10cSrcweir
115cdf0e10cSrcweir /*****************************************************************************/
GetSubInfo(ByteString & rKey,sal_Bool bSearchByPath,sal_Bool bCreatePath)116cdf0e10cSrcweir GenericInformation *GenericInformation::GetSubInfo( ByteString &rKey,
117cdf0e10cSrcweir sal_Bool bSearchByPath,
118cdf0e10cSrcweir sal_Bool bCreatePath )
119cdf0e10cSrcweir /*****************************************************************************/
120cdf0e10cSrcweir {
121cdf0e10cSrcweir if ( !pInfoList && bCreatePath )
122cdf0e10cSrcweir pInfoList = new GenericInformationList( this );
123cdf0e10cSrcweir if ( pInfoList )
124cdf0e10cSrcweir return pInfoList->GetInfo( rKey, bSearchByPath, bCreatePath );
125cdf0e10cSrcweir return NULL;
126cdf0e10cSrcweir }
127cdf0e10cSrcweir
128cdf0e10cSrcweir
129cdf0e10cSrcweir //
130cdf0e10cSrcweir // class GenericInformationList
131cdf0e10cSrcweir //
132cdf0e10cSrcweir
133cdf0e10cSrcweir /*****************************************************************************/
GenericInformationList(GenericInformation * pParent)134cdf0e10cSrcweir GenericInformationList::GenericInformationList( GenericInformation *pParent )
135cdf0e10cSrcweir /*****************************************************************************/
136cdf0e10cSrcweir : pOwner( pParent )
137cdf0e10cSrcweir {
138cdf0e10cSrcweir }
139cdf0e10cSrcweir
140cdf0e10cSrcweir /*****************************************************************************/
GenericInformationList(const GenericInformationList & rList,GenericInformation * pParent)141cdf0e10cSrcweir GenericInformationList::GenericInformationList(const GenericInformationList& rList,
142cdf0e10cSrcweir GenericInformation *pParent)
143cdf0e10cSrcweir /*****************************************************************************/
144cdf0e10cSrcweir : GenericInformationList_Impl()
145cdf0e10cSrcweir {
146cdf0e10cSrcweir sal_uInt16 i;
147cdf0e10cSrcweir GenericInformation* pTemp,*pWork;
148cdf0e10cSrcweir
149cdf0e10cSrcweir pOwner = pParent;
150cdf0e10cSrcweir
151cdf0e10cSrcweir for(i=0;i<rList.Count();i++)
152cdf0e10cSrcweir {
153cdf0e10cSrcweir pTemp = rList.GetObject(i);
154cdf0e10cSrcweir pWork = new GenericInformation(*pTemp,sal_True);
155cdf0e10cSrcweir
156cdf0e10cSrcweir Insert(pWork,LIST_APPEND);
157cdf0e10cSrcweir }
158cdf0e10cSrcweir }
159cdf0e10cSrcweir
160cdf0e10cSrcweir /*****************************************************************************/
~GenericInformationList()161cdf0e10cSrcweir GenericInformationList::~GenericInformationList()
162cdf0e10cSrcweir /*****************************************************************************/
163cdf0e10cSrcweir {
164cdf0e10cSrcweir // delete all Informations stored in this List
165cdf0e10cSrcweir // ### GH: Hier werden dann wohl etwa die H�lfte der Eintr�ge gel�scht
166cdf0e10cSrcweir /* for ( sal_uIntPtr i = 0; i < Count(); i++ ) {
167cdf0e10cSrcweir GetObject( i )->ListDeleted();
168cdf0e10cSrcweir delete GetObject( i );
169cdf0e10cSrcweir Remove( i );*/
170cdf0e10cSrcweir // Neue Variante:
171cdf0e10cSrcweir while ( Count() ) {
172cdf0e10cSrcweir GetObject( 0 )->ListDeleted();
173cdf0e10cSrcweir delete GetObject( 0 );
174cdf0e10cSrcweir Remove( (sal_uIntPtr)0 );
175cdf0e10cSrcweir }
176cdf0e10cSrcweir }
177cdf0e10cSrcweir
178cdf0e10cSrcweir /*****************************************************************************/
Search(sal_uIntPtr & rPos,ByteString sKey,sal_uIntPtr nStart,sal_uIntPtr nEnd)179cdf0e10cSrcweir GenericInformation *GenericInformationList::Search( sal_uIntPtr &rPos, ByteString sKey,
180cdf0e10cSrcweir sal_uIntPtr nStart, sal_uIntPtr nEnd )
181cdf0e10cSrcweir /*****************************************************************************/
182cdf0e10cSrcweir {
183cdf0e10cSrcweir if ( Count() == 0 ) {
184cdf0e10cSrcweir rPos = 0;
185cdf0e10cSrcweir return NULL;
186cdf0e10cSrcweir }
187cdf0e10cSrcweir
188cdf0e10cSrcweir if ( nStart == nEnd ) {
189cdf0e10cSrcweir rPos = nStart;
190cdf0e10cSrcweir ByteString sCandidate = ByteString( *GetObject( nStart ));
191cdf0e10cSrcweir if ( sCandidate.ToUpperAscii() == sKey.ToUpperAscii()) {
192cdf0e10cSrcweir return GetObject( nStart ); // found !!!
193cdf0e10cSrcweir }
194cdf0e10cSrcweir else {
195cdf0e10cSrcweir // requested key not found
196cdf0e10cSrcweir return NULL;
197cdf0e10cSrcweir }
198cdf0e10cSrcweir }
199cdf0e10cSrcweir
200cdf0e10cSrcweir // search binary in existing list
201cdf0e10cSrcweir sal_uIntPtr nActPos = nStart + (( nEnd - nStart ) / 2 );
202cdf0e10cSrcweir rPos = nActPos;
203cdf0e10cSrcweir ByteString sCandidate = ByteString( *GetObject( nActPos ));
204cdf0e10cSrcweir
205cdf0e10cSrcweir if ( sCandidate.ToUpperAscii() == sKey.ToUpperAscii())
206cdf0e10cSrcweir return GetObject( nActPos ); // found !!!
207cdf0e10cSrcweir
208cdf0e10cSrcweir // split the list at ActPos
209cdf0e10cSrcweir if ( sCandidate < sKey )
210cdf0e10cSrcweir return Search( rPos, sKey, nActPos + 1, nEnd );
211cdf0e10cSrcweir else
212cdf0e10cSrcweir return Search( rPos, sKey, nStart, nActPos );
213cdf0e10cSrcweir }
214cdf0e10cSrcweir
215cdf0e10cSrcweir /*****************************************************************************/
GetInfo(ByteString & rKey,sal_Bool bSearchByPath,sal_Bool bCreatePath)216cdf0e10cSrcweir GenericInformation *GenericInformationList::GetInfo( ByteString &rKey,
217cdf0e10cSrcweir sal_Bool bSearchByPath,
218cdf0e10cSrcweir sal_Bool bCreatePath )
219cdf0e10cSrcweir /*****************************************************************************/
220cdf0e10cSrcweir {
221cdf0e10cSrcweir
222cdf0e10cSrcweir rKey.EraseLeadingChars( '/' );
223cdf0e10cSrcweir rKey.EraseTrailingChars( '/' );
224cdf0e10cSrcweir
225cdf0e10cSrcweir ByteString sKey;
226cdf0e10cSrcweir if ( bSearchByPath )
227cdf0e10cSrcweir sKey = rKey.GetToken( 0, '/' );
228cdf0e10cSrcweir else
229cdf0e10cSrcweir sKey = rKey;
230cdf0e10cSrcweir
231cdf0e10cSrcweir sal_uIntPtr nPos = 0;
232cdf0e10cSrcweir GenericInformation *pReturnInfo = Search( nPos, sKey, 0, Count() - 1 );
233cdf0e10cSrcweir /* wenn kein Searchpath gesetzt und kein Returninfo vorhanden,
234cdf0e10cSrcweir * gib NULL zurueck
235cdf0e10cSrcweir * wenn Searchpath gesetzt und returninfo vorhanden,
236cdf0e10cSrcweir * suche weiter nach unten
237cdf0e10cSrcweir * wenn searchpath gesetzt kein returninfo vorhanden und newpath gesetzt,
238cdf0e10cSrcweir * mache neues Verzeichniss
239cdf0e10cSrcweir */
240cdf0e10cSrcweir sal_uInt16 nTokenCount = rKey.GetTokenCount('/');
241cdf0e10cSrcweir // search for next key of path in next level of tree
242cdf0e10cSrcweir if ( bSearchByPath && (nTokenCount > 1)) {
243cdf0e10cSrcweir ByteString sPath = ByteString(rKey.Copy( sKey.Len() + 1 ));
244cdf0e10cSrcweir if ( !pReturnInfo ) { // wenn kein Return, dann muss man es anlegen
245cdf0e10cSrcweir if ( !bCreatePath ) // wenn aber kein Create, dann nicht anlegen
246cdf0e10cSrcweir return NULL;
247cdf0e10cSrcweir pReturnInfo = new GenericInformation( sKey, "", this, NULL);
248cdf0e10cSrcweir pReturnInfo->SetSubList( new GenericInformationList( pReturnInfo ));
249cdf0e10cSrcweir }
250cdf0e10cSrcweir return pReturnInfo->GetSubInfo( sPath, sal_True, bCreatePath );
251cdf0e10cSrcweir }
252cdf0e10cSrcweir if ( !pReturnInfo && bCreatePath ) {
253cdf0e10cSrcweir pReturnInfo = new GenericInformation ( sKey, "", this, NULL);
254cdf0e10cSrcweir }
255cdf0e10cSrcweir
256cdf0e10cSrcweir return pReturnInfo; // kann durchaus NULL sein.
257cdf0e10cSrcweir }
258cdf0e10cSrcweir
259cdf0e10cSrcweir /*****************************************************************************/
InsertSorted(GenericInformation * pInfo,sal_Bool bOverwrite,sal_uIntPtr nStart,sal_uIntPtr nEnd)260cdf0e10cSrcweir sal_uIntPtr GenericInformationList::InsertSorted( GenericInformation *pInfo,
261cdf0e10cSrcweir sal_Bool bOverwrite,
262cdf0e10cSrcweir sal_uIntPtr nStart, sal_uIntPtr nEnd )
263cdf0e10cSrcweir /*****************************************************************************/
264cdf0e10cSrcweir {
265cdf0e10cSrcweir if ( Count() == 0 ) {
266cdf0e10cSrcweir // empty list, so insert at first pos
267cdf0e10cSrcweir Insert( pInfo, LIST_APPEND );
268cdf0e10cSrcweir return 0;
269cdf0e10cSrcweir }
270cdf0e10cSrcweir
271cdf0e10cSrcweir ByteString sKey( pInfo->GetBuffer());
272cdf0e10cSrcweir sKey.ToUpperAscii();
273cdf0e10cSrcweir
274cdf0e10cSrcweir // Check to sppeed up reading a (partially) sorted list
275cdf0e10cSrcweir if ( nStart == 0 && Count()-1 == nEnd )
276cdf0e10cSrcweir {
277cdf0e10cSrcweir ByteString sCandidate( *GetObject( nEnd ));
278cdf0e10cSrcweir if ( sCandidate.ToUpperAscii() < sKey )
279cdf0e10cSrcweir {
280cdf0e10cSrcweir Insert( pInfo, LIST_APPEND );
281cdf0e10cSrcweir return nEnd+1;
282cdf0e10cSrcweir }
283cdf0e10cSrcweir }
284cdf0e10cSrcweir
285cdf0e10cSrcweir // ### GH: dieser Block schein �berfl�ssig zu sein
286cdf0e10cSrcweir if ( Count() == 1 ) {
287cdf0e10cSrcweir ByteString sCandidate( *GetObject( 0 ));
288cdf0e10cSrcweir if ( sCandidate.ToUpperAscii() == sKey ) {
289cdf0e10cSrcweir // key allready exists in list
290cdf0e10cSrcweir if ( bOverwrite )
291cdf0e10cSrcweir Replace( pInfo, sal_uIntPtr(0)); // ### Laut NF scheint hier ein Memory Leak zu sein
292cdf0e10cSrcweir return 0;
293cdf0e10cSrcweir }
294cdf0e10cSrcweir else if ( sCandidate > sKey ) {
295cdf0e10cSrcweir Insert( pInfo, sal_uIntPtr(0));
296cdf0e10cSrcweir return 0;
297cdf0e10cSrcweir }
298cdf0e10cSrcweir else {
299cdf0e10cSrcweir Insert( pInfo, LIST_APPEND );
300cdf0e10cSrcweir return 1;
301cdf0e10cSrcweir }
302cdf0e10cSrcweir }
303cdf0e10cSrcweir // ### GH: /ENDE/ dieser Block schein �berfl�ssig zu sein
304cdf0e10cSrcweir
305cdf0e10cSrcweir sal_uIntPtr nActPos = nStart + (( nEnd - nStart ) / 2 );
306cdf0e10cSrcweir ByteString sCandidate = ByteString( *GetObject( nActPos ));
307cdf0e10cSrcweir
308cdf0e10cSrcweir if ( sCandidate.ToUpperAscii() == sKey ) {
309cdf0e10cSrcweir // key allready exists in list
310cdf0e10cSrcweir if ( bOverwrite )
311cdf0e10cSrcweir Replace( pInfo, nActPos ); // ### Laut NF scheint hier ein Memory Leak zu sein
312cdf0e10cSrcweir return nActPos;
313cdf0e10cSrcweir }
314cdf0e10cSrcweir
315cdf0e10cSrcweir if ( nStart == nEnd ) {
316cdf0e10cSrcweir // now more ways to search for key -> insert here
317cdf0e10cSrcweir if ( sCandidate > sKey ) {
318cdf0e10cSrcweir Insert( pInfo, nStart );
319cdf0e10cSrcweir return nStart;
320cdf0e10cSrcweir }
321cdf0e10cSrcweir else {
322cdf0e10cSrcweir Insert( pInfo, nStart + 1 );
323cdf0e10cSrcweir return ( nStart + 1 );
324cdf0e10cSrcweir }
325cdf0e10cSrcweir }
326cdf0e10cSrcweir
327cdf0e10cSrcweir if ( nActPos == Count() - 1 ) {
328cdf0e10cSrcweir // reached end of list -> insert here
329cdf0e10cSrcweir Insert( pInfo, LIST_APPEND );
330cdf0e10cSrcweir return ( nActPos + 1 );
331cdf0e10cSrcweir }
332cdf0e10cSrcweir
333cdf0e10cSrcweir ByteString sSecondCand = ByteString( *GetObject( nActPos + 1 ));
334cdf0e10cSrcweir if (( sCandidate < sKey ) && ( sSecondCand.ToUpperAscii() > sKey )) {
335cdf0e10cSrcweir // optimal position to insert object
336cdf0e10cSrcweir Insert( pInfo, nActPos + 1 );
337cdf0e10cSrcweir return ( nActPos + 1 );
338cdf0e10cSrcweir }
339cdf0e10cSrcweir
340cdf0e10cSrcweir if ( sCandidate < sKey )
341cdf0e10cSrcweir return InsertSorted( pInfo, bOverwrite, nActPos + 1, nEnd );
342cdf0e10cSrcweir else
343cdf0e10cSrcweir return InsertSorted( pInfo, bOverwrite, nStart, nActPos );
344cdf0e10cSrcweir }
345cdf0e10cSrcweir
346cdf0e10cSrcweir /*****************************************************************************/
InsertInfo(GenericInformation * pInfo,sal_Bool bOverwrite)347cdf0e10cSrcweir sal_Bool GenericInformationList::InsertInfo( GenericInformation *pInfo,
348cdf0e10cSrcweir sal_Bool bOverwrite )
349cdf0e10cSrcweir /*****************************************************************************/
350cdf0e10cSrcweir {
351cdf0e10cSrcweir if ( !pInfo->Len())
352cdf0e10cSrcweir return sal_False;
353cdf0e10cSrcweir
354cdf0e10cSrcweir InsertSorted( pInfo, bOverwrite, 0, Count() - 1 );
355cdf0e10cSrcweir return sal_True;
356cdf0e10cSrcweir }
357cdf0e10cSrcweir
358cdf0e10cSrcweir
359cdf0e10cSrcweir /*****************************************************************************/
InsertInfo(const ByteString & rPathKey,const ByteString & rValue,sal_Bool bSearchByPath,sal_Bool bNewPath)360cdf0e10cSrcweir sal_Bool GenericInformationList::InsertInfo( const ByteString &rPathKey, const ByteString &rValue,
361cdf0e10cSrcweir sal_Bool bSearchByPath, sal_Bool bNewPath )
362cdf0e10cSrcweir /*****************************************************************************/
363cdf0e10cSrcweir {
364cdf0e10cSrcweir GenericInformation *pInfo;
365cdf0e10cSrcweir ByteString sPathKey ( rPathKey );
366cdf0e10cSrcweir sPathKey.EraseLeadingChars( '/' );
367cdf0e10cSrcweir sPathKey.EraseTrailingChars( '/' );
368cdf0e10cSrcweir
369cdf0e10cSrcweir pInfo = GetInfo( sPathKey, bSearchByPath, bNewPath );
370cdf0e10cSrcweir
371cdf0e10cSrcweir if ( pInfo ) {
372cdf0e10cSrcweir pInfo->SetValue( rValue );
373cdf0e10cSrcweir return sal_True;
374cdf0e10cSrcweir }
375cdf0e10cSrcweir return sal_False;
376cdf0e10cSrcweir }
377cdf0e10cSrcweir
378cdf0e10cSrcweir /*****************************************************************************/
RemoveInfo(GenericInformation * pInfo,sal_Bool bDelete)379cdf0e10cSrcweir void GenericInformationList::RemoveInfo( GenericInformation *pInfo,
380cdf0e10cSrcweir sal_Bool bDelete )
381cdf0e10cSrcweir /*****************************************************************************/
382cdf0e10cSrcweir {
383cdf0e10cSrcweir Remove( pInfo );
384cdf0e10cSrcweir if ( bDelete )
385cdf0e10cSrcweir delete pInfo;
386cdf0e10cSrcweir /* if ( Count() == 0 && pOwner ) // Leere Listen entfernen;
387cdf0e10cSrcweir {
388cdf0e10cSrcweir SetOwner( NULL );
389cdf0e10cSrcweir delete this;
390cdf0e10cSrcweir } Rausgepatched by GH */
391cdf0e10cSrcweir }
392cdf0e10cSrcweir
SetOwner(GenericInformation * pNewOwner)393cdf0e10cSrcweir GenericInformation* GenericInformationList::SetOwner( GenericInformation *pNewOwner )
394cdf0e10cSrcweir {
395cdf0e10cSrcweir GenericInformation *pOldOwner = pOwner;
396cdf0e10cSrcweir if ( pOwner ) // bei parent austragen;
397cdf0e10cSrcweir pOwner->SetSubList( NULL );
398cdf0e10cSrcweir if ( pNewOwner )
399cdf0e10cSrcweir pNewOwner->SetSubList( this );
400cdf0e10cSrcweir pOwner = pNewOwner;
401cdf0e10cSrcweir return pOldOwner;
402cdf0e10cSrcweir }
403cdf0e10cSrcweir
404cdf0e10cSrcweir
405