LibreOffice Module sc (master) 1
refupdat.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include <refupdat.hxx>
21#include <document.hxx>
22#include <bigrange.hxx>
23#include <refdata.hxx>
24
25#include <osl/diagnose.h>
26
27template< typename R, typename S, typename U >
28static bool lcl_MoveStart( R& rRef, U nStart, S nDelta, U nMask )
29{
30 bool bCut = false;
31 if ( rRef >= nStart )
32 rRef = sal::static_int_cast<R>( rRef + nDelta );
33 else if ( nDelta < 0 && rRef >= nStart + nDelta )
34 rRef = nStart + nDelta; //TODO: limit ???
35 if ( rRef < 0 )
36 {
37 rRef = 0;
38 bCut = true;
39 }
40 else if ( rRef > nMask )
41 {
42 rRef = nMask;
43 bCut = true;
44 }
45 return bCut;
46}
47
48template< typename R, typename S, typename U >
49static bool lcl_MoveEnd( R& rRef, U nStart, S nDelta, U nMask )
50{
51 bool bCut = false;
52 if ( rRef >= nStart )
53 rRef = sal::static_int_cast<R>( rRef + nDelta );
54 else if ( nDelta < 0 && rRef >= nStart + nDelta )
55 rRef = nStart + nDelta - 1; //TODO: limit ???
56 if (rRef < 0)
57 {
58 rRef = 0;
59 bCut = true;
60 }
61 else if(rRef > nMask)
62 {
63 rRef = nMask;
64 bCut = true;
65 }
66 return bCut;
67}
68
69template< typename R, typename S, typename U >
70static bool lcl_MoveReorder( R& rRef, U nStart, U nEnd, S nDelta )
71{
72 if ( rRef >= nStart && rRef <= nEnd )
73 {
74 rRef = sal::static_int_cast<R>( rRef + nDelta );
75 return true;
76 }
77
78 if ( nDelta > 0 ) // move backward
79 {
80 if ( rRef >= nStart && rRef <= nEnd + nDelta )
81 {
82 if ( rRef <= nEnd )
83 rRef = sal::static_int_cast<R>( rRef + nDelta ); // in the moved range
84 else
85 rRef -= nEnd - nStart + 1; // move up
86 return true;
87 }
88 }
89 else // move forward
90 {
91 if ( rRef >= nStart + nDelta && rRef <= nEnd )
92 {
93 if ( rRef >= nStart )
94 rRef = sal::static_int_cast<R>( rRef + nDelta ); // in the moved range
95 else
96 rRef += nEnd - nStart + 1; // move up
97 return true;
98 }
99 }
100
101 return false;
102}
103
104template< typename R, typename S, typename U >
105static bool lcl_MoveItCut( R& rRef, S nDelta, U nMask )
106{
107 bool bCut = false;
108 rRef = sal::static_int_cast<R>( rRef + nDelta );
109 if ( rRef < 0 )
110 {
111 rRef = 0;
112 bCut = true;
113 }
114 else if ( rRef > nMask )
115 {
116 rRef = nMask;
117 bCut = true;
118 }
119 return bCut;
120}
121
122template< typename R, typename U >
123static void lcl_MoveItWrap( R& rRef, U nMask )
124{
125 rRef = sal::static_int_cast<R>( rRef );
126 if ( rRef < 0 )
127 rRef += nMask+1;
128 else if ( rRef > nMask )
129 rRef -= nMask+1;
130}
131
132template< typename R, typename S, typename U >
133static bool IsExpand( R n1, R n2, U nStart, S nD )
134{ // before normal Move...
135 return
136 nD > 0 // Insert
137 && n1 < n2 // at least two Cols/Rows/Tabs in Ref
138 && (
139 (nStart <= n1 && n1 < nStart + nD) // n1 within the Insert
140 || (n2 + 1 == nStart) // n2 directly before Insert
141 ); // n1 < nStart <= n2 is expanded anyway!
142}
143
144template< typename R, typename S, typename U >
145static void Expand( R& n1, R& n2, U nStart, S nD )
146{ // after normal Move..., only if IsExpand was true before!
147 // first the End
148 if ( n2 + 1 == nStart )
149 { // at End
150 n2 = sal::static_int_cast<R>( n2 + nD );
151 return;
152 }
153 // at the beginning
154 n1 = sal::static_int_cast<R>( n1 - nD );
155}
156
157static bool lcl_IsWrapBig( sal_Int64 nRef, sal_Int32 nDelta )
158{
159 if ( nRef > 0 && nDelta > 0 )
160 return nRef + nDelta <= 0;
161 else if ( nRef < 0 && nDelta < 0 )
162 return nRef + nDelta >= 0;
163 return false;
164}
165
166static bool lcl_MoveBig( sal_Int64& rRef, sal_Int64 nStart, sal_Int32 nDelta )
167{
168 bool bCut = false;
169 if ( rRef >= nStart )
170 {
171 if ( nDelta > 0 )
172 bCut = lcl_IsWrapBig( rRef, nDelta );
173 if ( bCut )
175 else
176 rRef += nDelta;
177 }
178 return bCut;
179}
180
181static bool lcl_MoveItCutBig( sal_Int64& rRef, sal_Int32 nDelta )
182{
183 bool bCut = lcl_IsWrapBig( rRef, nDelta );
184 rRef += nDelta;
185 return bCut;
186}
187
189 SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
190 SCCOL nCol2, SCROW nRow2, SCTAB nTab2,
191 SCCOL nDx, SCROW nDy, SCTAB nDz,
192 SCCOL& theCol1, SCROW& theRow1, SCTAB& theTab1,
193 SCCOL& theCol2, SCROW& theRow2, SCTAB& theTab2 )
194{
196
197 SCCOL oldCol1 = theCol1;
198 SCROW oldRow1 = theRow1;
199 SCTAB oldTab1 = theTab1;
200 SCCOL oldCol2 = theCol2;
201 SCROW oldRow2 = theRow2;
202 SCTAB oldTab2 = theTab2;
203
204 bool bCut1, bCut2;
205
206 if (eUpdateRefMode == URM_INSDEL)
207 {
208 bool bExpand = pDoc->IsExpandRefs();
209 if ( nDx && (theRow1 >= nRow1) && (theRow2 <= nRow2) &&
210 (theTab1 >= nTab1) && (theTab2 <= nTab2))
211 {
212 bool bExp = (bExpand && IsExpand( theCol1, theCol2, nCol1, nDx ));
213 bCut1 = lcl_MoveStart( theCol1, nCol1, nDx, pDoc->MaxCol() );
214 bCut2 = lcl_MoveEnd( theCol2, nCol1, nDx, pDoc->MaxCol() );
215 if ( theCol2 < theCol1 )
216 {
217 eRet = UR_INVALID;
218 theCol2 = theCol1;
219 }
220 else if (bCut2 && theCol2 == 0)
221 eRet = UR_INVALID;
222 else if ( bCut1 || bCut2 )
223 eRet = UR_UPDATED;
224 if ( bExp )
225 {
226 Expand( theCol1, theCol2, nCol1, nDx );
227 eRet = UR_UPDATED;
228 }
229 if (eRet != UR_NOTHING && oldCol1 == 0 && oldCol2 == pDoc->MaxCol())
230 {
231 eRet = UR_STICKY;
232 theCol1 = oldCol1;
233 theCol2 = oldCol2;
234 }
235 else if (oldCol2 == pDoc->MaxCol() && oldCol1 < pDoc->MaxCol())
236 {
237 // End was sticky, but start may have been moved. Only on range.
238 theCol2 = oldCol2;
239 if (eRet == UR_NOTHING)
240 eRet = UR_STICKY;
241 }
242 // Else, if (bCut2 && theCol2 == pDoc->MaxCol()) then end becomes sticky,
243 // but currently there's nothing to do.
244 }
245 if ( nDy && (theCol1 >= nCol1) && (theCol2 <= nCol2) &&
246 (theTab1 >= nTab1) && (theTab2 <= nTab2))
247 {
248 bool bExp = (bExpand && IsExpand( theRow1, theRow2, nRow1, nDy ));
249 bCut1 = lcl_MoveStart( theRow1, nRow1, nDy, pDoc->MaxRow() );
250 bCut2 = lcl_MoveEnd( theRow2, nRow1, nDy, pDoc->MaxRow() );
251 if ( theRow2 < theRow1 )
252 {
253 eRet = UR_INVALID;
254 theRow2 = theRow1;
255 }
256 else if (bCut2 && theRow2 == 0)
257 eRet = UR_INVALID;
258 else if ( bCut1 || bCut2 )
259 eRet = UR_UPDATED;
260 if ( bExp )
261 {
262 Expand( theRow1, theRow2, nRow1, nDy );
263 eRet = UR_UPDATED;
264 }
265 if (eRet != UR_NOTHING && oldRow1 == 0 && oldRow2 == pDoc->MaxRow())
266 {
267 eRet = UR_STICKY;
268 theRow1 = oldRow1;
269 theRow2 = oldRow2;
270 }
271 else if (oldRow2 == pDoc->MaxRow() && oldRow1 < pDoc->MaxRow())
272 {
273 // End was sticky, but start may have been moved. Only on range.
274 theRow2 = oldRow2;
275 if (eRet == UR_NOTHING)
276 eRet = UR_STICKY;
277 }
278 // Else, if (bCut2 && theRow2 == pDoc->MaxRow()) then end becomes sticky,
279 // but currently there's nothing to do.
280 }
281 if ( nDz && (theCol1 >= nCol1) && (theCol2 <= nCol2) &&
282 (theRow1 >= nRow1) && (theRow2 <= nRow2) )
283 {
284 SCTAB nMaxTab = pDoc->GetTableCount() - 1;
285 nMaxTab = sal::static_int_cast<SCTAB>(nMaxTab + nDz); // adjust to new count
286 bool bExp = (bExpand && IsExpand( theTab1, theTab2, nTab1, nDz ));
287 bCut1 = lcl_MoveStart( theTab1, nTab1, nDz, nMaxTab );
288 bCut2 = lcl_MoveEnd( theTab2, nTab1, nDz, nMaxTab );
289 if ( bCut1 || bCut2 )
290 eRet = UR_UPDATED;
291 if ( bExp )
292 {
293 Expand( theTab1, theTab2, nTab1, nDz );
294 eRet = UR_UPDATED;
295 }
296 }
297 }
298 else if (eUpdateRefMode == URM_MOVE)
299 {
300 if ((theCol1 >= nCol1-nDx) && (theRow1 >= nRow1-nDy) && (theTab1 >= nTab1-nDz) &&
301 (theCol2 <= nCol2-nDx) && (theRow2 <= nRow2-nDy) && (theTab2 <= nTab2-nDz))
302 {
303 if ( nDx )
304 {
305 bCut1 = lcl_MoveItCut( theCol1, nDx, pDoc->MaxCol() );
306 bCut2 = lcl_MoveItCut( theCol2, nDx, pDoc->MaxCol() );
307 if ( bCut1 || bCut2 )
308 eRet = UR_UPDATED;
309 if (eRet != UR_NOTHING && oldCol1 == 0 && oldCol2 == pDoc->MaxCol())
310 {
311 eRet = UR_STICKY;
312 theCol1 = oldCol1;
313 theCol2 = oldCol2;
314 }
315 }
316 if ( nDy )
317 {
318 bCut1 = lcl_MoveItCut( theRow1, nDy, pDoc->MaxRow() );
319 bCut2 = lcl_MoveItCut( theRow2, nDy, pDoc->MaxRow() );
320 if ( bCut1 || bCut2 )
321 eRet = UR_UPDATED;
322 if (eRet != UR_NOTHING && oldRow1 == 0 && oldRow2 == pDoc->MaxRow())
323 {
324 eRet = UR_STICKY;
325 theRow1 = oldRow1;
326 theRow2 = oldRow2;
327 }
328 }
329 if ( nDz )
330 {
331 SCTAB nMaxTab = pDoc->GetTableCount() - 1;
332 bCut1 = lcl_MoveItCut( theTab1, nDz, nMaxTab );
333 bCut2 = lcl_MoveItCut( theTab2, nDz, nMaxTab );
334 if ( bCut1 || bCut2 )
335 eRet = UR_UPDATED;
336 }
337 }
338 }
339 else if (eUpdateRefMode == URM_REORDER)
340 {
341 // so far only for nDz (MoveTab)
342 OSL_ENSURE ( !nDx && !nDy, "URM_REORDER for x and y not yet implemented" );
343
344 if ( nDz && (theCol1 >= nCol1) && (theCol2 <= nCol2) &&
345 (theRow1 >= nRow1) && (theRow2 <= nRow2) )
346 {
347 bCut1 = lcl_MoveReorder( theTab1, nTab1, nTab2, nDz );
348 bCut2 = lcl_MoveReorder( theTab2, nTab1, nTab2, nDz );
349 if ( bCut1 || bCut2 )
350 eRet = UR_UPDATED;
351 }
352 }
353
354 if ( eRet == UR_NOTHING )
355 {
356 if (oldCol1 != theCol1
357 || oldRow1 != theRow1
358 || oldTab1 != theTab1
359 || oldCol2 != theCol2
360 || oldRow2 != theRow2
361 || oldTab2 != theTab2
362 )
363 eRet = UR_UPDATED;
364 }
365 return eRet;
366}
367
368// simple UpdateReference for ScBigRange (ScChangeAction/ScChangeTrack)
369// References can also be located outside of the document!
370// Whole columns/rows (ScBigRange::nRangeMin..ScBigRange::nRangeMax) stay as such!
372 const ScBigRange& rWhere, sal_Int32 nDx, sal_Int32 nDy, sal_Int32 nDz,
373 ScBigRange& rWhat )
374{
376 const ScBigRange aOldRange( rWhat );
377
378 sal_Int64 nCol1, nRow1, nTab1, nCol2, nRow2, nTab2;
379 sal_Int64 theCol1, theRow1, theTab1, theCol2, theRow2, theTab2;
380 rWhere.GetVars( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2 );
381 rWhat.GetVars( theCol1, theRow1, theTab1, theCol2, theRow2, theTab2 );
382
383 bool bCut1, bCut2;
384
385 if (eUpdateRefMode == URM_INSDEL)
386 {
387 if ( nDx && (theRow1 >= nRow1) && (theRow2 <= nRow2) &&
388 (theTab1 >= nTab1) && (theTab2 <= nTab2) &&
389 (theCol1 != ScBigRange::nRangeMin || theCol2 != ScBigRange::nRangeMax) )
390 {
391 bCut1 = lcl_MoveBig( theCol1, nCol1, nDx );
392 bCut2 = lcl_MoveBig( theCol2, nCol1, nDx );
393 if ( bCut1 || bCut2 )
394 eRet = UR_UPDATED;
395 rWhat.aStart.SetCol( theCol1 );
396 rWhat.aEnd.SetCol( theCol2 );
397 }
398 if ( nDy && (theCol1 >= nCol1) && (theCol2 <= nCol2) &&
399 (theTab1 >= nTab1) && (theTab2 <= nTab2) &&
400 (theRow1 != ScBigRange::nRangeMin || theRow2 != ScBigRange::nRangeMax) )
401 {
402 bCut1 = lcl_MoveBig( theRow1, nRow1, nDy );
403 bCut2 = lcl_MoveBig( theRow2, nRow1, nDy );
404 if ( bCut1 || bCut2 )
405 eRet = UR_UPDATED;
406 rWhat.aStart.SetRow( theRow1 );
407 rWhat.aEnd.SetRow( theRow2 );
408 }
409 if ( nDz && (theCol1 >= nCol1) && (theCol2 <= nCol2) &&
410 (theRow1 >= nRow1) && (theRow2 <= nRow2) &&
411 (theTab1 != ScBigRange::nRangeMin || theTab2 != ScBigRange::nRangeMax) )
412 {
413 bCut1 = lcl_MoveBig( theTab1, nTab1, nDz );
414 bCut2 = lcl_MoveBig( theTab2, nTab1, nDz );
415 if ( bCut1 || bCut2 )
416 eRet = UR_UPDATED;
417 rWhat.aStart.SetTab( theTab1 );
418 rWhat.aEnd.SetTab( theTab2 );
419 }
420 }
421 else if (eUpdateRefMode == URM_MOVE)
422 {
423 if ( rWhere.Contains( rWhat ) )
424 {
425 if ( nDx && (theCol1 != ScBigRange::nRangeMin || theCol2 != ScBigRange::nRangeMax) )
426 {
427 bCut1 = lcl_MoveItCutBig( theCol1, nDx );
428 bCut2 = lcl_MoveItCutBig( theCol2, nDx );
429 if ( bCut1 || bCut2 )
430 eRet = UR_UPDATED;
431 rWhat.aStart.SetCol( theCol1 );
432 rWhat.aEnd.SetCol( theCol2 );
433 }
434 if ( nDy && (theRow1 != ScBigRange::nRangeMin || theRow2 != ScBigRange::nRangeMax) )
435 {
436 bCut1 = lcl_MoveItCutBig( theRow1, nDy );
437 bCut2 = lcl_MoveItCutBig( theRow2, nDy );
438 if ( bCut1 || bCut2 )
439 eRet = UR_UPDATED;
440 rWhat.aStart.SetRow( theRow1 );
441 rWhat.aEnd.SetRow( theRow2 );
442 }
443 if ( nDz && (theTab1 != ScBigRange::nRangeMin || theTab2 != ScBigRange::nRangeMax) )
444 {
445 bCut1 = lcl_MoveItCutBig( theTab1, nDz );
446 bCut2 = lcl_MoveItCutBig( theTab2, nDz );
447 if ( bCut1 || bCut2 )
448 eRet = UR_UPDATED;
449 rWhat.aStart.SetTab( theTab1 );
450 rWhat.aEnd.SetTab( theTab2 );
451 }
452 }
453 }
454
455 if ( eRet == UR_NOTHING && rWhat != aOldRange )
456 eRet = UR_UPDATED;
457
458 return eRet;
459}
460
461void ScRefUpdate::MoveRelWrap( const ScDocument& rDoc, const ScAddress& rPos,
462 SCCOL nMaxCol, SCROW nMaxRow, ScComplexRefData& rRef )
463{
464 ScRange aAbsRange = rRef.toAbs(rDoc, rPos);
465 if( rRef.Ref1.IsColRel() )
466 {
467 SCCOL nCol = aAbsRange.aStart.Col();
468 lcl_MoveItWrap(nCol, nMaxCol);
469 aAbsRange.aStart.SetCol(nCol);
470 }
471 if( rRef.Ref2.IsColRel() )
472 {
473 SCCOL nCol = aAbsRange.aEnd.Col();
474 lcl_MoveItWrap(nCol, nMaxCol);
475 aAbsRange.aEnd.SetCol(nCol);
476 }
477 if( rRef.Ref1.IsRowRel() )
478 {
479 SCROW nRow = aAbsRange.aStart.Row();
480 lcl_MoveItWrap(nRow, nMaxRow);
481 aAbsRange.aStart.SetRow(nRow);
482 }
483 if( rRef.Ref2.IsRowRel() )
484 {
485 SCROW nRow = aAbsRange.aEnd.Row();
486 lcl_MoveItWrap(nRow, nMaxRow);
487 aAbsRange.aEnd.SetRow(nRow);
488 }
489 SCTAB nMaxTab = rDoc.GetTableCount() - 1;
490 if( rRef.Ref1.IsTabRel() )
491 {
492 SCTAB nTab = aAbsRange.aStart.Tab();
493 lcl_MoveItWrap(nTab, nMaxTab);
494 aAbsRange.aStart.SetTab(nTab);
495 }
496 if( rRef.Ref2.IsTabRel() )
497 {
498 SCTAB nTab = aAbsRange.aEnd.Tab();
499 lcl_MoveItWrap(nTab, nMaxTab);
500 aAbsRange.aEnd.SetTab(nTab);
501 }
502
503 aAbsRange.PutInOrder();
504 rRef.SetRange(rDoc.GetSheetLimits(), aAbsRange, rPos);
505}
506
507void ScRefUpdate::DoTranspose( SCCOL& rCol, SCROW& rRow, SCTAB& rTab,
508 const ScDocument& rDoc, const ScRange& rSource, const ScAddress& rDest )
509{
510 SCTAB nDz = rDest.Tab() - rSource.aStart.Tab();
511 if (nDz)
512 {
513 SCTAB nNewTab = rTab+nDz;
514 SCTAB nCount = rDoc.GetTableCount();
515 while (nNewTab<0) nNewTab = sal::static_int_cast<SCTAB>( nNewTab + nCount );
516 while (nNewTab>=nCount) nNewTab = sal::static_int_cast<SCTAB>( nNewTab - nCount );
517 rTab = nNewTab;
518 }
519 OSL_ENSURE( rCol>=rSource.aStart.Col() && rRow>=rSource.aStart.Row(),
520 "UpdateTranspose: pos. wrong" );
521
522 SCCOL nRelX = rCol - rSource.aStart.Col();
523 SCROW nRelY = rRow - rSource.aStart.Row();
524
525 rCol = static_cast<SCCOL>(static_cast<SCCOLROW>(rDest.Col()) +
526 static_cast<SCCOLROW>(nRelY));
527 rRow = static_cast<SCROW>(static_cast<SCCOLROW>(rDest.Row()) +
528 static_cast<SCCOLROW>(nRelX));
529}
530
532 const ScDocument& rDoc, const ScRange& rSource, const ScAddress& rDest, ScRange& rRef )
533{
535 // Only references in source range must be updated, i.e. no references in destination area.
536 // Otherwise existing references pointing to destination area will be wrongly transposed.
537 if (rSource.Contains(rRef))
538 {
539 // Source range contains the reference range.
540 SCCOL nCol1 = rRef.aStart.Col(), nCol2 = rRef.aEnd.Col();
541 SCROW nRow1 = rRef.aStart.Row(), nRow2 = rRef.aEnd.Row();
542 SCTAB nTab1 = rRef.aStart.Tab(), nTab2 = rRef.aEnd.Tab();
543 DoTranspose(nCol1, nRow1, nTab1, rDoc, rSource, rDest);
544 DoTranspose(nCol2, nRow2, nTab2, rDoc, rSource, rDest);
545 rRef.aStart = ScAddress(nCol1, nRow1, nTab1);
546 rRef.aEnd = ScAddress(nCol2, nRow2, nTab2);
547 eRet = UR_UPDATED;
548 }
549 return eRet;
550}
551
552// UpdateGrow - expands references which point exactly to the area
553// gets by without document
554
556 const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY, ScRange& rRef )
557{
559
560 // in y-direction the Ref may also start one row further below,
561 // if an area contains column heads
562
563 bool bUpdateX = ( nGrowX &&
564 rRef.aStart.Col() == rArea.aStart.Col() && rRef.aEnd.Col() == rArea.aEnd.Col() &&
565 rRef.aStart.Row() >= rArea.aStart.Row() && rRef.aEnd.Row() <= rArea.aEnd.Row() &&
566 rRef.aStart.Tab() >= rArea.aStart.Tab() && rRef.aEnd.Tab() <= rArea.aEnd.Tab() );
567 bool bUpdateY = ( nGrowY &&
568 rRef.aStart.Col() >= rArea.aStart.Col() && rRef.aEnd.Col() <= rArea.aEnd.Col() &&
569 (rRef.aStart.Row() == rArea.aStart.Row() || rRef.aStart.Row() == rArea.aStart.Row()+1) &&
570 rRef.aEnd.Row() == rArea.aEnd.Row() &&
571 rRef.aStart.Tab() >= rArea.aStart.Tab() && rRef.aEnd.Tab() <= rArea.aEnd.Tab() );
572
573 if ( bUpdateX )
574 {
575 rRef.aEnd.SetCol(sal::static_int_cast<SCCOL>(rRef.aEnd.Col() + nGrowX));
576 eRet = UR_UPDATED;
577 }
578 if ( bUpdateY )
579 {
580 rRef.aEnd.SetRow(sal::static_int_cast<SCROW>(rRef.aEnd.Row() + nGrowY));
581 eRet = UR_UPDATED;
582 }
583
584 return eRet;
585}
586
587/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SCTAB Tab() const
Definition: address.hxx:283
void SetCol(SCCOL nColP)
Definition: address.hxx:291
SCROW Row() const
Definition: address.hxx:274
void SetRow(SCROW nRowP)
Definition: address.hxx:287
void SetTab(SCTAB nTabP)
Definition: address.hxx:295
SCCOL Col() const
Definition: address.hxx:279
void SetCol(sal_Int64 nColP)
Definition: bigrange.hxx:50
void SetTab(sal_Int64 nTabP)
Definition: bigrange.hxx:52
void SetRow(sal_Int64 nRowP)
Definition: bigrange.hxx:51
ScBigAddress aEnd
Definition: bigrange.hxx:109
static constexpr sal_Int64 nRangeMin
Definition: bigrange.hxx:150
static constexpr sal_Int64 nRangeMax
Definition: bigrange.hxx:151
ScBigAddress aStart
Definition: bigrange.hxx:108
bool Contains(const ScBigAddress &) const
is Address& in range?
Definition: bigrange.hxx:154
void GetVars(sal_Int64 &nCol1, sal_Int64 &nRow1, sal_Int64 &nTab1, sal_Int64 &nCol2, sal_Int64 &nRow2, sal_Int64 &nTab2) const
Definition: bigrange.hxx:127
ScSheetLimits & GetSheetLimits() const
Definition: document.hxx:898
SC_DLLPUBLIC SCCOL MaxCol() const
Definition: document.hxx:892
SC_DLLPUBLIC SCROW MaxRow() const
Definition: document.hxx:893
bool IsExpandRefs() const
Definition: document.hxx:2457
SC_DLLPUBLIC SCTAB GetTableCount() const
Definition: document.cxx:297
void PutInOrder()
Definition: address.hxx:622
ScAddress aEnd
Definition: address.hxx:498
bool Contains(const ScAddress &) const
is Address& fully in Range?
Definition: address.hxx:718
ScAddress aStart
Definition: address.hxx:497
static ScRefUpdateRes UpdateTranspose(const ScDocument &rDoc, const ScRange &rSource, const ScAddress &rDest, ScRange &rRef)
Definition: refupdat.cxx:531
static ScRefUpdateRes Update(const ScDocument *pDoc, UpdateRefMode eUpdateRefMode, SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2, SCCOL nDx, SCROW nDy, SCTAB nDz, SCCOL &theCol1, SCROW &theRow1, SCTAB &theTab1, SCCOL &theCol2, SCROW &theRow2, SCTAB &theTab2)
Definition: refupdat.cxx:188
static void DoTranspose(SCCOL &rCol, SCROW &rRow, SCTAB &rTab, const ScDocument &rDoc, const ScRange &rSource, const ScAddress &rDest)
Definition: refupdat.cxx:507
static void MoveRelWrap(const ScDocument &rDoc, const ScAddress &rPos, SCCOL nMaxCol, SCROW nMaxRow, ScComplexRefData &rRef)
Definition: refupdat.cxx:461
static ScRefUpdateRes UpdateGrow(const ScRange &rArea, SCCOL nGrowX, SCROW nGrowY, ScRange &rRef)
Definition: refupdat.cxx:555
int nCount
UpdateRefMode
Definition: global.hxx:301
@ URM_MOVE
Definition: global.hxx:304
@ URM_REORDER
Definition: global.hxx:305
@ URM_INSDEL
Definition: global.hxx:302
sal_Int32 nRef
int n2
int n1
static bool lcl_MoveStart(R &rRef, U nStart, S nDelta, U nMask)
Definition: refupdat.cxx:28
static bool lcl_MoveReorder(R &rRef, U nStart, U nEnd, S nDelta)
Definition: refupdat.cxx:70
static void lcl_MoveItWrap(R &rRef, U nMask)
Definition: refupdat.cxx:123
static void Expand(R &n1, R &n2, U nStart, S nD)
Definition: refupdat.cxx:145
static bool lcl_MoveBig(sal_Int64 &rRef, sal_Int64 nStart, sal_Int32 nDelta)
Definition: refupdat.cxx:166
static bool IsExpand(R n1, R n2, U nStart, S nD)
Definition: refupdat.cxx:133
static bool lcl_MoveItCut(R &rRef, S nDelta, U nMask)
Definition: refupdat.cxx:105
static bool lcl_MoveItCutBig(sal_Int64 &rRef, sal_Int32 nDelta)
Definition: refupdat.cxx:181
static bool lcl_MoveEnd(R &rRef, U nStart, S nDelta, U nMask)
Definition: refupdat.cxx:49
static bool lcl_IsWrapBig(sal_Int64 nRef, sal_Int32 nDelta)
Definition: refupdat.cxx:157
ScRefUpdateRes
Definition: refupdat.hxx:30
@ UR_INVALID
Some part of the reference became invalid.
Definition: refupdat.hxx:33
@ UR_STICKY
Not updated because the reference is sticky, but would had been updated if it wasn't.
Definition: refupdat.hxx:34
@ UR_NOTHING
Reference not affected, no change at all.
Definition: refupdat.hxx:31
@ UR_UPDATED
Reference was adjusted/updated.
Definition: refupdat.hxx:32
Complex reference (a range) into the sheet.
Definition: refdata.hxx:123
SC_DLLPUBLIC ScRange toAbs(const ScSheetLimits &rLimits, const ScAddress &rPos) const
Definition: refdata.cxx:493
ScSingleRefData Ref2
Definition: refdata.hxx:125
void SetRange(const ScSheetLimits &rLimits, const ScRange &rRange, const ScAddress &rPos)
Set a new range, assuming that the ordering of the range matches the ordering of the reference data f...
Definition: refdata.cxx:498
ScSingleRefData Ref1
Definition: refdata.hxx:124
bool IsTabRel() const
Definition: refdata.hxx:69
bool IsRowRel() const
Definition: refdata.hxx:67
bool IsColRel() const
Definition: refdata.hxx:65
sal_Int32 SCCOLROW
a type capable of holding either SCCOL or SCROW
Definition: types.hxx:23
sal_Int16 SCTAB
Definition: types.hxx:22
sal_Int16 SCCOL
Definition: types.hxx:21
sal_Int32 SCROW
Definition: types.hxx:17
const sal_uInt8 R
Definition: xlformula.cxx:50