xref: /trunk/main/sc/source/core/inc/refupdat.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_REFUPDAT_HXX
29 #define SC_REFUPDAT_HXX
30 
31 #include "global.hxx"
32 
33 class ScDocument;
34 class ScBigRange;
35 struct ScComplexRefData;
36 class ScAddress;
37 class ScRange;
38 
39 enum ScRefUpdateRes {
40 	UR_NOTHING	= 0,		// keine Anpassungen
41 	UR_UPDATED	= 1,		// Anpassungen erfolgt
42 	UR_INVALID	= 2			// Referenz wurde ungueltig
43 };
44 
45 class ScRefUpdate
46 {
47 public:
48 
49     /// What type of reference is to be updated.
50     enum WhatType
51     {
52         ALL,        /// all references
53         ABSOLUTE    /// only absolute references
54     };
55 
56 	static ScRefUpdateRes Update
57 		( ScDocument* pDoc, UpdateRefMode eUpdateRefMode,
58 							SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
59 							SCCOL nCol2, SCROW nRow2, SCTAB nTab2,
60 							SCsCOL nDx, SCsROW nDy, SCsTAB nDz,
61 							SCCOL& theCol1, SCROW& theRow1, SCTAB& theTab1,
62 							SCCOL& theCol2, SCROW& theRow2, SCTAB& theTab2 );
63 
64 	static ScRefUpdateRes Update( UpdateRefMode eUpdateRefMode,
65 								const ScBigRange& rWhere,
66 								sal_Int32 nDx, sal_Int32 nDy, sal_Int32 nDz,
67 								ScBigRange& rWhat );
68 
69     /// Before calling, the absolute references must be up-to-date!
70 	static ScRefUpdateRes Update( ScDocument* pDoc,
71 								  UpdateRefMode eUpdateRefMode,
72 								  const ScAddress& rPos, const ScRange& rRange,
73 								  SCsCOL nDx, SCsROW nDy, SCsTAB nDz,
74 								  ScComplexRefData& rRef, WhatType eWhat = ALL );
75 
76     /// Before calling, the absolute references must be up-to-date!
77 	static ScRefUpdateRes Move( ScDocument* pDoc, const ScAddress& rPos,
78 								SCsCOL nDx, SCsROW nDy, SCsTAB nDz,
79 								ScComplexRefData& rRef, sal_Bool bWrap, sal_Bool bAbsolute );
80 
81     static void MoveRelWrap( ScDocument* pDoc, const ScAddress& rPos,
82                              SCCOL nMaxCol, SCROW nMaxRow, ScComplexRefData& rRef );
83 
84     /// Before calling, the absolute references must be up-to-date!
85 	static ScRefUpdateRes UpdateTranspose( ScDocument* pDoc,
86 								const ScRange& rSource, const ScAddress& rDest,
87 								ScComplexRefData& rRef );
88 
89 	static void DoTranspose( SCsCOL& rCol, SCsROW& rRow, SCsTAB& rTab, ScDocument* pDoc,
90 								const ScRange& rSource, const ScAddress& rDest );
91 
92     /// Before calling, the absolute references must be up-to-date!
93 	static ScRefUpdateRes UpdateGrow(
94 								const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY,
95 								ScComplexRefData& rRef );
96 };
97 
98 
99 #endif
100 
101