1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include "detdata.hxx"
21 #include "refupdat.hxx"
22 #include "rechead.hxx"
24 ScDetOpList::ScDetOpList(const ScDetOpList
& rList
) :
27 size_t nCount
= rList
.Count();
29 for (size_t i
=0; i
<nCount
; i
++)
30 Append( new ScDetOpData(rList
.aDetOpDataVector
[i
]) );
33 void ScDetOpList::DeleteOnTab( SCTAB nTab
)
35 for (ScDetOpDataVector::iterator it
= aDetOpDataVector
.begin(); it
!= aDetOpDataVector
.end(); /*noop*/ )
37 // look for operations on the deleted sheet
38 if (it
->GetPos().Tab() == nTab
)
39 it
= aDetOpDataVector
.erase( it
);
45 void ScDetOpList::UpdateReference( ScDocument
* pDoc
, UpdateRefMode eUpdateRefMode
,
46 const ScRange
& rRange
, SCsCOL nDx
, SCsROW nDy
, SCsTAB nDz
)
48 for (ScDetOpDataVector::iterator it
= aDetOpDataVector
.begin(); it
!= aDetOpDataVector
.end(); ++it
)
50 ScAddress aPos
= it
->GetPos();
51 SCCOL nCol1
= aPos
.Col();
52 SCROW nRow1
= aPos
.Row();
53 SCTAB nTab1
= aPos
.Tab();
59 ScRefUpdate::Update( pDoc
, eUpdateRefMode
,
60 rRange
.aStart
.Col(), rRange
.aStart
.Row(), rRange
.aStart
.Tab(),
61 rRange
.aEnd
.Col(), rRange
.aEnd
.Row(), rRange
.aEnd
.Tab(), nDx
, nDy
, nDz
,
62 nCol1
, nRow1
, nTab1
, nCol2
, nRow2
, nTab2
);
63 if ( eRes
!= UR_NOTHING
)
64 it
->SetPos( ScAddress( nCol1
, nRow1
, nTab1
) );
68 void ScDetOpList::Append( ScDetOpData
* pDetOpData
)
70 if ( pDetOpData
->GetOperation() == SCDETOP_ADDERROR
)
73 aDetOpDataVector
.push_back( pDetOpData
);
76 bool ScDetOpList::operator==( const ScDetOpList
& r
) const
80 size_t nCount
= Count();
81 bool bEqual
= ( nCount
== r
.Count() );
82 for (size_t i
=0; i
<nCount
&& bEqual
; i
++) // order has to be the same
83 if ( !(aDetOpDataVector
[i
] == r
.aDetOpDataVector
[i
]) ) // entries are different ?
89 const ScDetOpData
* ScDetOpList::GetObject( size_t nPos
) const
91 return &aDetOpDataVector
[nPos
];
94 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */