xref: /aoo41x/main/sc/inc/detdata.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef SC_DETDATA_HXX
29 #define SC_DETDATA_HXX
30 
31 #include <svl/svarray.hxx>
32 #include "global.hxx"
33 #include "address.hxx"
34 
35 
36 //------------------------------------------------------------------------
37 
38 #define SC_DETOP_GROW	4
39 
40 //------------------------------------------------------------------------
41 enum ScDetOpType
42 {
43 	SCDETOP_ADDSUCC,
44 	SCDETOP_DELSUCC,
45 	SCDETOP_ADDPRED,
46 	SCDETOP_DELPRED,
47 	SCDETOP_ADDERROR
48 };
49 
50 //------------------------------------------------------------------------
51 
52 class ScDetOpData
53 {
54 	ScAddress		aPos;
55 	ScDetOpType		eOperation;
56 
57 public:
58 						ScDetOpData( const ScAddress& rP, ScDetOpType eOp ) :
59 							aPos(rP), eOperation(eOp) {}
60 
61 						ScDetOpData( const ScDetOpData& rData ) :
62 							aPos(rData.aPos), eOperation(rData.eOperation) {}
63 
64 	const ScAddress&	GetPos() const			{ return aPos; }
65 	ScDetOpType			GetOperation() const	{ return eOperation; }
66 
67 	// fuer UpdateRef:
68 	void				SetPos(const ScAddress& rNew)	{ aPos=rNew; }
69 
70 	int operator==		( const ScDetOpData& r ) const
71 							{ return eOperation == r.eOperation && aPos == r.aPos; }
72 };
73 
74 //------------------------------------------------------------------------
75 
76 //
77 //	Liste der Operationen
78 //
79 
80 typedef ScDetOpData* ScDetOpDataPtr;
81 
82 SV_DECL_PTRARR_DEL(ScDetOpArr_Impl, ScDetOpDataPtr, SC_DETOP_GROW, SC_DETOP_GROW)
83 
84 class ScDetOpList : public ScDetOpArr_Impl
85 {
86 	sal_Bool	bHasAddError;		// updated in Append
87 
88 public:
89 		ScDetOpList() : bHasAddError(sal_False) {}
90 		ScDetOpList(const ScDetOpList& rList);
91 		~ScDetOpList() {}
92 
93     void    DeleteOnTab( SCTAB nTab );
94 	void	UpdateReference( ScDocument* pDoc, UpdateRefMode eUpdateRefMode,
95 								const ScRange& rRange, SCsCOL nDx, SCsROW nDy, SCsTAB nDz );
96 
97 	sal_Bool	operator==( const ScDetOpList& r ) const;		// fuer Ref-Undo
98 
99 	void	Append( ScDetOpData* pData );
100 
101 	sal_Bool	HasAddError() const		{ return bHasAddError; }
102 };
103 
104 
105 
106 #endif
107