xref: /AOO41X/main/sc/inc/detdata.hxx (revision 38d50f7b14e1cf975d8c6468d9633894cd59b523)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef SC_DETDATA_HXX
25 #define SC_DETDATA_HXX
26 
27 #include <svl/svarray.hxx>
28 #include "global.hxx"
29 #include "address.hxx"
30 
31 
32 //------------------------------------------------------------------------
33 
34 #define SC_DETOP_GROW   4
35 
36 //------------------------------------------------------------------------
37 enum ScDetOpType
38 {
39     SCDETOP_ADDSUCC,
40     SCDETOP_DELSUCC,
41     SCDETOP_ADDPRED,
42     SCDETOP_DELPRED,
43     SCDETOP_ADDERROR
44 };
45 
46 //------------------------------------------------------------------------
47 
48 class ScDetOpData
49 {
50     ScAddress       aPos;
51     ScDetOpType     eOperation;
52 
53 public:
ScDetOpData(const ScAddress & rP,ScDetOpType eOp)54                         ScDetOpData( const ScAddress& rP, ScDetOpType eOp ) :
55                             aPos(rP), eOperation(eOp) {}
56 
ScDetOpData(const ScDetOpData & rData)57                         ScDetOpData( const ScDetOpData& rData ) :
58                             aPos(rData.aPos), eOperation(rData.eOperation) {}
59 
GetPos() const60     const ScAddress&    GetPos() const          { return aPos; }
GetOperation() const61     ScDetOpType         GetOperation() const    { return eOperation; }
62 
63     // fuer UpdateRef:
SetPos(const ScAddress & rNew)64     void                SetPos(const ScAddress& rNew)   { aPos=rNew; }
65 
operator ==(const ScDetOpData & r) const66     int operator==      ( const ScDetOpData& r ) const
67                             { return eOperation == r.eOperation && aPos == r.aPos; }
68 };
69 
70 //------------------------------------------------------------------------
71 
72 //
73 //  Liste der Operationen
74 //
75 
76 typedef ScDetOpData* ScDetOpDataPtr;
77 
78 SV_DECL_PTRARR_DEL(ScDetOpArr_Impl, ScDetOpDataPtr, SC_DETOP_GROW, SC_DETOP_GROW)
79 
80 class ScDetOpList : public ScDetOpArr_Impl
81 {
82     sal_Bool    bHasAddError;       // updated in Append
83 
84 public:
ScDetOpList()85         ScDetOpList() : bHasAddError(sal_False) {}
86         ScDetOpList(const ScDetOpList& rList);
~ScDetOpList()87         ~ScDetOpList() {}
88 
89     void    DeleteOnTab( SCTAB nTab );
90     void    UpdateReference( ScDocument* pDoc, UpdateRefMode eUpdateRefMode,
91                                 const ScRange& rRange, SCsCOL nDx, SCsROW nDy, SCsTAB nDz );
92 
93     sal_Bool    operator==( const ScDetOpList& r ) const;       // fuer Ref-Undo
94 
95     void    Append( ScDetOpData* pData );
96 
HasAddError() const97     sal_Bool    HasAddError() const     { return bHasAddError; }
98 };
99 
100 
101 
102 #endif
103