Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include "detdata.hxx"
30 : : #include "refupdat.hxx"
31 : : #include "rechead.hxx"
32 : :
33 : : //------------------------------------------------------------------------
34 : :
35 : 0 : ScDetOpList::ScDetOpList(const ScDetOpList& rList) :
36 : 0 : bHasAddError( false )
37 : : {
38 [ # # ]: 0 : size_t nCount = rList.Count();
39 : :
40 [ # # ]: 0 : for (size_t i=0; i<nCount; i++)
41 [ # # ][ # # ]: 0 : Append( new ScDetOpData(rList.aDetOpDataVector[i]) );
[ # # ]
42 : 0 : }
43 : :
44 : 0 : void ScDetOpList::DeleteOnTab( SCTAB nTab )
45 : : {
46 [ # # ][ # # ]: 0 : for (ScDetOpDataVector::iterator it = aDetOpDataVector.begin(); it != aDetOpDataVector.end(); /*noop*/ )
[ # # ][ # # ]
47 : : {
48 : : // look for operations on the deleted sheet
49 [ # # ][ # # ]: 0 : if (it->GetPos().Tab() == nTab)
50 [ # # ]: 0 : it = aDetOpDataVector.erase( it);
51 : : else
52 [ # # ]: 0 : ++it;
53 : : }
54 : 0 : }
55 : :
56 : 0 : void ScDetOpList::UpdateReference( ScDocument* pDoc, UpdateRefMode eUpdateRefMode,
57 : : const ScRange& rRange, SCsCOL nDx, SCsROW nDy, SCsTAB nDz )
58 : : {
59 [ # # ][ # # ]: 0 : for (ScDetOpDataVector::iterator it = aDetOpDataVector.begin(); it != aDetOpDataVector.end(); ++it )
[ # # ][ # # ]
[ # # ]
60 : : {
61 [ # # ]: 0 : ScAddress aPos = it->GetPos();
62 : 0 : SCCOL nCol1 = aPos.Col();
63 : 0 : SCROW nRow1 = aPos.Row();
64 : 0 : SCTAB nTab1 = aPos.Tab();
65 : 0 : SCCOL nCol2 = nCol1;
66 : 0 : SCROW nRow2 = nRow1;
67 : 0 : SCTAB nTab2 = nTab1;
68 : :
69 : : ScRefUpdateRes eRes =
70 : : ScRefUpdate::Update( pDoc, eUpdateRefMode,
71 : 0 : rRange.aStart.Col(), rRange.aStart.Row(), rRange.aStart.Tab(),
72 : 0 : rRange.aEnd.Col(), rRange.aEnd.Row(), rRange.aEnd.Tab(), nDx, nDy, nDz,
73 [ # # ]: 0 : nCol1, nRow1, nTab1, nCol2, nRow2, nTab2 );
74 [ # # ]: 0 : if ( eRes != UR_NOTHING )
75 [ # # ]: 0 : it->SetPos( ScAddress( nCol1, nRow1, nTab1 ) );
76 : : }
77 : 0 : }
78 : :
79 : 1 : void ScDetOpList::Append( ScDetOpData* pDetOpData )
80 : : {
81 [ - + ]: 1 : if ( pDetOpData->GetOperation() == SCDETOP_ADDERROR )
82 : 0 : bHasAddError = sal_True;
83 : :
84 : 1 : aDetOpDataVector.push_back( pDetOpData );
85 : 1 : }
86 : :
87 : :
88 : 0 : sal_Bool ScDetOpList::operator==( const ScDetOpList& r ) const
89 : : {
90 : : // fuer Ref-Undo
91 : :
92 : 0 : size_t nCount = Count();
93 : 0 : sal_Bool bEqual = ( nCount == r.Count() );
94 [ # # ][ # # ]: 0 : for (size_t i=0; i<nCount && bEqual; i++) // Reihenfolge muss auch gleich sein
[ # # ]
95 [ # # ]: 0 : if ( !(aDetOpDataVector[i] == r.aDetOpDataVector[i]) ) // Eintraege unterschiedlich ?
96 : 0 : bEqual = false;
97 : :
98 : 0 : return bEqual;
99 : : }
100 : :
101 : 12 : const ScDetOpData* ScDetOpList::GetObject( size_t nPos ) const
102 : : {
103 : 12 : return &aDetOpDataVector[nPos];
104 : : }
105 : :
106 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|