fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / sc / source / core / tool / detdata.cxx
blobe7fb6c43287a918f57427f91011ea78541a76fc1
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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) :
25 bHasAddError( false )
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);
40 else
41 ++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();
54 SCCOL nCol2 = nCol1;
55 SCROW nRow2 = nRow1;
56 SCTAB nTab2 = nTab1;
58 ScRefUpdateRes eRes =
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 )
71 bHasAddError = true;
73 aDetOpDataVector.push_back( pDetOpData );
76 bool ScDetOpList::operator==( const ScDetOpList& r ) const
78 // for Ref-Undo
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 ?
84 bEqual = false;
86 return bEqual;
89 const ScDetOpData* ScDetOpList::GetObject( size_t nPos ) const
91 return &aDetOpDataVector[nPos];
94 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */