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 .
21 #include <detdata.hxx>
22 #include <refupdat.hxx>
24 ScDetOpList::ScDetOpList(const ScDetOpList
& rList
) :
25 bHasAddError( false ),
26 aDetOpDataVector( rList
.aDetOpDataVector
)
30 void ScDetOpList::DeleteOnTab( SCTAB nTab
)
32 std::erase_if(aDetOpDataVector
,
33 [&nTab
](const ScDetOpData
& rxDetOpData
) {
34 return rxDetOpData
.GetPos().Tab() == nTab
; // look for operations on the deleted sheet
38 void ScDetOpList::UpdateReference( const ScDocument
* pDoc
, UpdateRefMode eUpdateRefMode
,
39 const ScRange
& rRange
, SCCOL nDx
, SCROW nDy
, SCTAB nDz
)
41 for (auto& rxDetOpData
: aDetOpDataVector
)
43 ScAddress aPos
= rxDetOpData
.GetPos();
44 SCCOL nCol1
= aPos
.Col();
45 SCROW nRow1
= aPos
.Row();
46 SCTAB nTab1
= aPos
.Tab();
52 ScRefUpdate::Update( pDoc
, eUpdateRefMode
,
53 rRange
.aStart
.Col(), rRange
.aStart
.Row(), rRange
.aStart
.Tab(),
54 rRange
.aEnd
.Col(), rRange
.aEnd
.Row(), rRange
.aEnd
.Tab(), nDx
, nDy
, nDz
,
55 nCol1
, nRow1
, nTab1
, nCol2
, nRow2
, nTab2
);
56 if ( eRes
!= UR_NOTHING
)
57 rxDetOpData
.SetPos( ScAddress( nCol1
, nRow1
, nTab1
) );
61 void ScDetOpList::Append( const ScDetOpData
& rDetOpData
)
63 if ( rDetOpData
.GetOperation() == SCDETOP_ADDERROR
)
66 aDetOpDataVector
.push_back( rDetOpData
);
69 bool ScDetOpList::operator==( const ScDetOpList
& r
) const
73 size_t nCount
= Count();
74 bool bEqual
= ( nCount
== r
.Count() );
75 for (size_t i
=0; i
<nCount
&& bEqual
; i
++) // order has to be the same
76 if ( !(aDetOpDataVector
[i
] == r
.aDetOpDataVector
[i
]) ) // entries are different ?
82 const ScDetOpData
& ScDetOpList::GetObject( size_t nPos
) const
84 return aDetOpDataVector
[nPos
];
87 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */