1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: detdata.cxx,v $
10 * $Revision: 1.8.32.2 $
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_sc.hxx"
36 // INCLUDE ---------------------------------------------------------------
38 #include <tools/debug.hxx>
40 #include "detdata.hxx"
41 #include "refupdat.hxx"
42 #include "rechead.hxx"
44 //------------------------------------------------------------------------
46 SV_IMPL_PTRARR( ScDetOpArr_Impl
, ScDetOpDataPtr
);
48 //------------------------------------------------------------------------
50 ScDetOpList::ScDetOpList(const ScDetOpList
& rList
) :
54 USHORT nCount
= rList
.Count();
56 for (USHORT i
=0; i
<nCount
; i
++)
57 Append( new ScDetOpData(*rList
[i
]) );
60 void ScDetOpList::DeleteOnTab( SCTAB nTab
)
63 while ( nPos
< Count() )
65 // look for operations on the deleted sheet
67 if ( (*this)[nPos
]->GetPos().Tab() == nTab
)
74 void ScDetOpList::UpdateReference( ScDocument
* pDoc
, UpdateRefMode eUpdateRefMode
,
75 const ScRange
& rRange
, SCsCOL nDx
, SCsROW nDy
, SCsTAB nDz
)
77 USHORT nCount
= Count();
78 for (USHORT i
=0; i
<nCount
; i
++)
80 ScAddress aPos
= (*this)[i
]->GetPos();
81 SCCOL nCol1
= aPos
.Col();
82 SCROW nRow1
= aPos
.Row();
83 SCTAB nTab1
= aPos
.Tab();
89 ScRefUpdate::Update( pDoc
, eUpdateRefMode
,
90 rRange
.aStart
.Col(), rRange
.aStart
.Row(), rRange
.aStart
.Tab(),
91 rRange
.aEnd
.Col(), rRange
.aEnd
.Row(), rRange
.aEnd
.Tab(), nDx
, nDy
, nDz
,
92 nCol1
, nRow1
, nTab1
, nCol2
, nRow2
, nTab2
);
93 if ( eRes
!= UR_NOTHING
)
94 (*this)[i
]->SetPos( ScAddress( nCol1
, nRow1
, nTab1
) );
98 void ScDetOpList::Append( ScDetOpData
* pDetOpData
)
100 if ( pDetOpData
->GetOperation() == SCDETOP_ADDERROR
)
103 Insert( pDetOpData
, Count() );
107 BOOL
ScDetOpList::operator==( const ScDetOpList
& r
) const
111 USHORT nCount
= Count();
112 BOOL bEqual
= ( nCount
== r
.Count() );
113 for (USHORT i
=0; i
<nCount
&& bEqual
; i
++) // Reihenfolge muss auch gleich sein
114 if ( !(*(*this)[i
] == *r
[i
]) ) // Eintraege unterschiedlich ?