2010-10-12 15:59:00 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2000-09-18 23:16:46 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-10 18:51:12 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2000-09-18 23:16:46 +00:00
|
|
|
*
|
2010-02-12 15:01:35 +01:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2000-09-18 23:16:46 +00:00
|
|
|
*
|
2008-04-10 18:51:12 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2000-09-18 23:16:46 +00:00
|
|
|
*
|
2008-04-10 18:51:12 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2000-09-18 23:16:46 +00:00
|
|
|
*
|
2008-04-10 18:51:12 +00:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2000-09-18 23:16:46 +00:00
|
|
|
*
|
2008-04-10 18:51:12 +00:00
|
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2000-09-18 23:16:46 +00:00
|
|
|
*
|
2008-04-10 18:51:12 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
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
|
|
|
{
|
|
|
|
// fuer Ref-Undo
|
|
|
|
|
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-02-10 17:26:44 +01:00
|
|
|
for (size_t i=0; i<nCount && bEqual; i++) // Reihenfolge muss auch gleich sein
|
2012-02-10 13:47:22 +01:00
|
|
|
if ( !(aDetOpDataVector[i] == r.aDetOpDataVector[i]) ) // Eintraege unterschiedlich ?
|
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: */
|