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_sw.hxx" 26 27 28 29 #include "ring.hxx" 30 31 32 /************************************************************************* 33 |* 34 |* Ring::Ring() 35 |* 36 |* Ersterstellung VB 02.07.91 37 |* Letzte Aenderung JP 10.10.97 38 |* 39 *************************************************************************/ 40 Ring(Ring * pObj)41Ring::Ring( Ring *pObj ) 42 { 43 if( !pObj ) 44 pNext = this, pPrev = this; 45 else 46 { 47 pNext = pObj; 48 pPrev = pObj->pPrev; 49 pObj->pPrev = this; 50 pPrev->pNext = this; 51 } 52 } 53 54 /************************************************************************* 55 |* 56 |* Ring::~Ring() 57 |* 58 |* Ersterstellung VB 02.07.91 59 |* Letzte Aenderung JP 10.10.97 60 |* 61 *************************************************************************/ 62 ~Ring()63Ring::~Ring() 64 { 65 pNext->pPrev = pPrev; 66 pPrev->pNext = pNext; 67 } 68 69 /************************************************************************* 70 |* 71 |* Ring::MoveTo 72 |* 73 |* Ersterstellung VB 4.3.91 74 |* Letzte Aenderung JP 10.10.97 75 |* 76 *************************************************************************/ 77 MoveTo(Ring * pDestRing)78void Ring::MoveTo(Ring *pDestRing) 79 { 80 // loeschen aus dem alten 81 pNext->pPrev = pPrev; 82 pPrev->pNext = pNext; 83 84 // im neuen einfuegen 85 if( pDestRing ) 86 { 87 pNext = pDestRing; 88 pPrev = pDestRing->pPrev; 89 pDestRing->pPrev = this; 90 pPrev->pNext = this; 91 } 92 else 93 pNext = pPrev = this; 94 95 } 96 MoveRingTo(Ring * pDestRing)97void Ring::MoveRingTo(Ring *pDestRing) 98 { 99 // den gesamten Ring in den DestRing einfuegen 100 Ring* pMyPrev = pPrev; 101 Ring* pDestPrev = pDestRing->pPrev; 102 103 pMyPrev->pNext = pDestRing; 104 pDestPrev->pNext = this; 105 pDestRing->pPrev = pMyPrev; 106 pPrev = pDestPrev; 107 } 108 numberOf() const109sal_uInt32 Ring::numberOf() const 110 { 111 sal_uInt32 nRet = 1; 112 const Ring* pNxt = pNext; 113 while( pNxt != this ) 114 { 115 ++nRet; 116 pNxt = pNxt->GetNext(); 117 } 118 return nRet; 119 } 120 121 122