Update ooo320-m1
[ooovba.git] / sw / source / core / bastyp / ring.cxx
blob958fb6c03494b102754991f46d96b02470cb0599
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: ring.cxx,v $
10 * $Revision: 1.6 $
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_sw.hxx"
36 #include "ring.hxx"
39 /*************************************************************************
41 |* Ring::Ring()
43 |* Ersterstellung VB 02.07.91
44 |* Letzte Aenderung JP 10.10.97
46 *************************************************************************/
48 Ring::Ring( Ring *pObj )
50 if( !pObj )
51 pNext = this, pPrev = this;
52 else
54 pNext = pObj;
55 pPrev = pObj->pPrev;
56 pObj->pPrev = this;
57 pPrev->pNext = this;
61 /*************************************************************************
63 |* Ring::~Ring()
65 |* Ersterstellung VB 02.07.91
66 |* Letzte Aenderung JP 10.10.97
68 *************************************************************************/
70 Ring::~Ring()
72 pNext->pPrev = pPrev;
73 pPrev->pNext = pNext;
76 /*************************************************************************
78 |* Ring::MoveTo
80 |* Ersterstellung VB 4.3.91
81 |* Letzte Aenderung JP 10.10.97
83 *************************************************************************/
85 void Ring::MoveTo(Ring *pDestRing)
87 // loeschen aus dem alten
88 pNext->pPrev = pPrev;
89 pPrev->pNext = pNext;
91 // im neuen einfuegen
92 if( pDestRing )
94 pNext = pDestRing;
95 pPrev = pDestRing->pPrev;
96 pDestRing->pPrev = this;
97 pPrev->pNext = this;
99 else
100 pNext = pPrev = this;
104 void Ring::MoveRingTo(Ring *pDestRing)
106 // den gesamten Ring in den DestRing einfuegen
107 Ring* pMyPrev = pPrev;
108 Ring* pDestPrev = pDestRing->pPrev;
110 pMyPrev->pNext = pDestRing;
111 pDestPrev->pNext = this;
112 pDestRing->pPrev = pMyPrev;
113 pPrev = pDestPrev;
116 sal_uInt32 Ring::numberOf() const
118 sal_uInt32 nRet = 1;
119 const Ring* pNxt = pNext;
120 while( pNxt != this )
122 ++nRet;
123 pNxt = pNxt->GetNext();
125 return nRet;