2010-10-12 15:59:00 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-11-30 12:23:25 +00:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
|
|
#include "detdata.hxx"
|
|
|
|
#include "refupdat.hxx"
|
|
|
|
#include "rechead.hxx"
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------
|
|
|
|
|
2002-11-04 14:46:18 +00:00
|
|
|
ScDetOpList::ScDetOpList(const ScDetOpList& rList) :
|
2011-03-10 16:55:21 -05:00
|
|
|
bHasAddError( false )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2012-02-10 17:26:44 +01:00
|
|
|
size_t nCount = rList.Count();
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2012-02-10 17:26:44 +01:00
|
|
|
for (size_t i=0; i<nCount; i++)
|
2012-02-10 13:47:22 +01:00
|
|
|
Append( new ScDetOpData(rList.aDetOpDataVector[i]) );
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
|
2005-09-28 10:37:33 +00:00
|
|
|
void ScDetOpList::DeleteOnTab( SCTAB nTab )
|
|
|
|
{
|
2012-02-10 17:26:44 +01:00
|
|
|
for (ScDetOpDataVector::iterator it = aDetOpDataVector.begin(); it != aDetOpDataVector.end(); /*noop*/ )
|
2005-09-28 10:37:33 +00:00
|
|
|
{
|
|
|
|
// look for operations on the deleted sheet
|
2012-02-10 17:26:44 +01:00
|
|
|
if (it->GetPos().Tab() == nTab)
|
|
|
|
it = aDetOpDataVector.erase( it);
|
2005-09-28 10:37:33 +00:00
|
|
|
else
|
2012-02-10 17:26:44 +01:00
|
|
|
++it;
|
2005-09-28 10:37:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-09-18 23:16:46 +00:00
|
|
|
void ScDetOpList::UpdateReference( ScDocument* pDoc, UpdateRefMode eUpdateRefMode,
|
2004-06-04 09:35:22 +00:00
|
|
|
const ScRange& rRange, SCsCOL nDx, SCsROW nDy, SCsTAB nDz )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2012-02-10 17:26:44 +01:00
|
|
|
for (ScDetOpDataVector::iterator it = aDetOpDataVector.begin(); it != aDetOpDataVector.end(); ++it )
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2012-02-10 17:26:44 +01:00
|
|
|
ScAddress aPos = it->GetPos();
|
2004-06-04 09:35:22 +00:00
|
|
|
SCCOL nCol1 = aPos.Col();
|
|
|
|
SCROW nRow1 = aPos.Row();
|
|
|
|
SCTAB nTab1 = aPos.Tab();
|
|
|
|
SCCOL nCol2 = nCol1;
|
|
|
|
SCROW nRow2 = nRow1;
|
|
|
|
SCTAB nTab2 = nTab1;
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
|
|
ScRefUpdateRes eRes =
|
|
|
|
ScRefUpdate::Update( pDoc, eUpdateRefMode,
|
|
|
|
rRange.aStart.Col(), rRange.aStart.Row(), rRange.aStart.Tab(),
|
|
|
|
rRange.aEnd.Col(), rRange.aEnd.Row(), rRange.aEnd.Tab(), nDx, nDy, nDz,
|
|
|
|
nCol1, nRow1, nTab1, nCol2, nRow2, nTab2 );
|
|
|
|
if ( eRes != UR_NOTHING )
|
2012-02-10 17:26:44 +01:00
|
|
|
it->SetPos( ScAddress( nCol1, nRow1, nTab1 ) );
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-02-27 11:14:57 +00:00
|
|
|
void ScDetOpList::Append( ScDetOpData* pDetOpData )
|
2002-11-04 14:46:18 +00:00
|
|
|
{
|
2007-02-27 11:14:57 +00:00
|
|
|
if ( pDetOpData->GetOperation() == SCDETOP_ADDERROR )
|
2011-01-17 13:20:22 +01:00
|
|
|
bHasAddError = sal_True;
|
2002-11-04 14:46:18 +00:00
|
|
|
|
2012-02-10 13:47:22 +01:00
|
|
|
aDetOpDataVector.push_back( pDetOpData );
|
2002-11-04 14:46:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_Bool ScDetOpList::operator==( const ScDetOpList& r ) const
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
2012-08-31 17:19:29 +02:00
|
|
|
// for Ref-Undo
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2012-02-10 17:26:44 +01:00
|
|
|
size_t nCount = Count();
|
2011-01-17 13:20:22 +01:00
|
|
|
sal_Bool bEqual = ( nCount == r.Count() );
|
2012-08-31 17:19:29 +02:00
|
|
|
for (size_t i=0; i<nCount && bEqual; i++) // order has to be the same
|
|
|
|
if ( !(aDetOpDataVector[i] == r.aDetOpDataVector[i]) ) // entries are different ?
|
2011-03-10 16:55:21 -05:00
|
|
|
bEqual = false;
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
|
|
return bEqual;
|
|
|
|
}
|
|
|
|
|
2012-02-10 17:26:44 +01:00
|
|
|
const ScDetOpData* ScDetOpList::GetObject( size_t nPos ) const
|
2012-02-10 13:47:22 +01:00
|
|
|
{
|
2012-02-10 17:26:44 +01:00
|
|
|
return &aDetOpDataVector[nPos];
|
2012-02-10 13:47:22 +01:00
|
|
|
}
|
|
|
|
|
2010-10-12 15:59:00 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|