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