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 ( theTab2 < theTab1 )
290 {
291 eRet = UR_INVALID;
292 theTab2 = theTab1;
293 }
294 else if (bCut2 && theTab2 == 0)
295 eRet = UR_INVALID;
296 else if ( bCut1 || bCut2 )
297 eRet = UR_UPDATED;
298 if ( bExp )
299 {
300 Expand( theTab1, theTab2, nTab1, nDz );
301 eRet = UR_UPDATED;
302 }
303 }
304 }
305 else if (eUpdateRefMode == URM_MOVE)
306 {
307 if ((theCol1 >= nCol1-nDx) && (theRow1 >= nRow1-nDy) && (theTab1 >= nTab1-nDz) &&
308 (theCol2 <= nCol2-nDx) && (theRow2 <= nRow2-nDy) && (theTab2 <= nTab2-nDz))
309 {
310 if ( nDx )
311 {
312 bCut1 = lcl_MoveItCut( theCol1, nDx, pDoc->MaxCol() );
313 bCut2 = lcl_MoveItCut( theCol2, nDx, pDoc->MaxCol() );
314 if ( bCut1 || bCut2 )
315 eRet = UR_UPDATED;
316 if (eRet != UR_NOTHING && oldCol1 == 0 && oldCol2 == pDoc->MaxCol())
317 {
318 eRet = UR_STICKY;
319 theCol1 = oldCol1;
320 theCol2 = oldCol2;
321 }
322 }
323 if ( nDy )
324 {
325 bCut1 = lcl_MoveItCut( theRow1, nDy, pDoc->MaxRow() );
326 bCut2 = lcl_MoveItCut( theRow2, nDy, pDoc->MaxRow() );
327 if ( bCut1 || bCut2 )
328 eRet = UR_UPDATED;
329 if (eRet != UR_NOTHING && oldRow1 == 0 && oldRow2 == pDoc->MaxRow())
330 {
331 eRet = UR_STICKY;
332 theRow1 = oldRow1;
333 theRow2 = oldRow2;
334 }
335 }
336 if ( nDz )
337 {
338 SCTAB nMaxTab = pDoc->GetTableCount() - 1;
339 bCut1 = lcl_MoveItCut( theTab1, nDz, nMaxTab );
340 bCut2 = lcl_MoveItCut( theTab2, nDz, nMaxTab );
341 if ( bCut1 || bCut2 )
342 eRet = UR_UPDATED;
343 }
344 }
345 }
346 else if (eUpdateRefMode == URM_REORDER)
347 {
348 // so far only for nDz (MoveTab)
349 OSL_ENSURE ( !nDx && !nDy, "URM_REORDER for x and y not yet implemented" );
350
351 if ( nDz && (theCol1 >= nCol1) && (theCol2 <= nCol2) &&
352 (theRow1 >= nRow1) && (theRow2 <= nRow2) )
353 {
354 bCut1 = lcl_MoveReorder( theTab1, nTab1, nTab2, nDz );
355 bCut2 = lcl_MoveReorder( theTab2, nTab1, nTab2, nDz );
356 if ( bCut1 || bCut2 )
357 eRet = UR_UPDATED;
358 }
359 }
360
361 if ( eRet == UR_NOTHING )
362 {
363 if (oldCol1 != theCol1
364 || oldRow1 != theRow1
365 || oldTab1 != theTab1
366 || oldCol2 != theCol2
367 || oldRow2 != theRow2
368 || oldTab2 != theTab2
369 )
370 eRet = UR_UPDATED;
371 }
372 return eRet;
373}
374
375// simple UpdateReference for ScBigRange (ScChangeAction/ScChangeTrack)
376// References can also be located outside of the document!
377// Whole columns/rows (ScBigRange::nRangeMin..ScBigRange::nRangeMax) stay as such!
379 const ScBigRange& rWhere, sal_Int32 nDx, sal_Int32 nDy, sal_Int32 nDz,
380 ScBigRange& rWhat )
381{
383 const ScBigRange aOldRange( rWhat );
384
385 sal_Int64 nCol1, nRow1, nTab1, nCol2, nRow2, nTab2;
386 sal_Int64 theCol1, theRow1, theTab1, theCol2, theRow2, theTab2;
387 rWhere.GetVars( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2 );
388 rWhat.GetVars( theCol1, theRow1, theTab1, theCol2, theRow2, theTab2 );
389
390 bool bCut1, bCut2;
391
392 if (eUpdateRefMode == URM_INSDEL)
393 {
394 if ( nDx && (theRow1 >= nRow1) && (theRow2 <= nRow2) &&
395 (theTab1 >= nTab1) && (theTab2 <= nTab2) &&
396 (theCol1 != ScBigRange::nRangeMin || theCol2 != ScBigRange::nRangeMax) )
397 {
398 bCut1 = lcl_MoveBig( theCol1, nCol1, nDx );
399 bCut2 = lcl_MoveBig( theCol2, nCol1, nDx );
400 if ( bCut1 || bCut2 )
401 eRet = UR_UPDATED;
402 rWhat.aStart.SetCol( theCol1 );
403 rWhat.aEnd.SetCol( theCol2 );
404 }
405 if ( nDy && (theCol1 >= nCol1) && (theCol2 <= nCol2) &&
406 (theTab1 >= nTab1) && (theTab2 <= nTab2) &&
407 (theRow1 != ScBigRange::nRangeMin || theRow2 != ScBigRange::nRangeMax) )
408 {
409 bCut1 = lcl_MoveBig( theRow1, nRow1, nDy );
410 bCut2 = lcl_MoveBig( theRow2, nRow1, nDy );
411 if ( bCut1 || bCut2 )
412 eRet = UR_UPDATED;
413 rWhat.aStart.SetRow( theRow1 );
414 rWhat.aEnd.SetRow( theRow2 );
415 }
416 if ( nDz && (theCol1 >= nCol1) && (theCol2 <= nCol2) &&
417 (theRow1 >= nRow1) && (theRow2 <= nRow2) &&
418 (theTab1 != ScBigRange::nRangeMin || theTab2 != ScBigRange::nRangeMax) )
419 {
420 bCut1 = lcl_MoveBig( theTab1, nTab1, nDz );
421 bCut2 = lcl_MoveBig( theTab2, nTab1, nDz );
422 if ( bCut1 || bCut2 )
423 eRet = UR_UPDATED;
424 rWhat.aStart.SetTab( theTab1 );
425 rWhat.aEnd.SetTab( theTab2 );
426 }
427 }
428 else if (eUpdateRefMode == URM_MOVE)
429 {
430 if ( rWhere.Contains( rWhat ) )
431 {
432 if ( nDx && (theCol1 != ScBigRange::nRangeMin || theCol2 != ScBigRange::nRangeMax) )
433 {
434 bCut1 = lcl_MoveItCutBig( theCol1, nDx );
435 bCut2 = lcl_MoveItCutBig( theCol2, nDx );
436 if ( bCut1 || bCut2 )
437 eRet = UR_UPDATED;
438 rWhat.aStart.SetCol( theCol1 );
439 rWhat.aEnd.SetCol( theCol2 );
440 }
441 if ( nDy && (theRow1 != ScBigRange::nRangeMin || theRow2 != ScBigRange::nRangeMax) )
442 {
443 bCut1 = lcl_MoveItCutBig( theRow1, nDy );
444 bCut2 = lcl_MoveItCutBig( theRow2, nDy );
445 if ( bCut1 || bCut2 )
446 eRet = UR_UPDATED;
447 rWhat.aStart.SetRow( theRow1 );
448 rWhat.aEnd.SetRow( theRow2 );
449 }
450 if ( nDz && (theTab1 != ScBigRange::nRangeMin || theTab2 != ScBigRange::nRangeMax) )
451 {
452 bCut1 = lcl_MoveItCutBig( theTab1, nDz );
453 bCut2 = lcl_MoveItCutBig( theTab2, nDz );
454 if ( bCut1 || bCut2 )
455 eRet = UR_UPDATED;
456 rWhat.aStart.SetTab( theTab1 );
457 rWhat.aEnd.SetTab( theTab2 );
458 }
459 }
460 }
461
462 if ( eRet == UR_NOTHING && rWhat != aOldRange )
463 eRet = UR_UPDATED;
464
465 return eRet;
466}
467
468void ScRefUpdate::MoveRelWrap( const ScDocument& rDoc, const ScAddress& rPos,
469 SCCOL nMaxCol, SCROW nMaxRow, ScComplexRefData& rRef )
470{
471 ScRange aAbsRange = rRef.toAbs(rDoc, rPos);
472 if( rRef.Ref1.IsColRel() )
473 {
474 SCCOL nCol = aAbsRange.aStart.Col();
475 lcl_MoveItWrap(nCol, nMaxCol);
476 aAbsRange.aStart.SetCol(nCol);
477 }
478 if( rRef.Ref2.IsColRel() )
479 {
480 SCCOL nCol = aAbsRange.aEnd.Col();
481 lcl_MoveItWrap(nCol, nMaxCol);
482 aAbsRange.aEnd.SetCol(nCol);
483 }
484 if( rRef.Ref1.IsRowRel() )
485 {
486 SCROW nRow = aAbsRange.aStart.Row();
487 lcl_MoveItWrap(nRow, nMaxRow);
488 aAbsRange.aStart.SetRow(nRow);
489 }
490 if( rRef.Ref2.IsRowRel() )
491 {
492 SCROW nRow = aAbsRange.aEnd.Row();
493 lcl_MoveItWrap(nRow, nMaxRow);
494 aAbsRange.aEnd.SetRow(nRow);
495 }
496 SCTAB nMaxTab = rDoc.GetTableCount() - 1;
497 if( rRef.Ref1.IsTabRel() )
498 {
499 SCTAB nTab = aAbsRange.aStart.Tab();
500 lcl_MoveItWrap(nTab, nMaxTab);
501 aAbsRange.aStart.SetTab(nTab);
502 }
503 if( rRef.Ref2.IsTabRel() )
504 {
505 SCTAB nTab = aAbsRange.aEnd.Tab();
506 lcl_MoveItWrap(nTab, nMaxTab);
507 aAbsRange.aEnd.SetTab(nTab);
508 }
509
510 aAbsRange.PutInOrder();
511 rRef.SetRange(rDoc.GetSheetLimits(), aAbsRange, rPos);
512}
513
514void ScRefUpdate::DoTranspose( SCCOL& rCol, SCROW& rRow, SCTAB& rTab,
515 const ScDocument& rDoc, const ScRange& rSource, const ScAddress& rDest )
516{
517 SCTAB nDz = rDest.Tab() - rSource.aStart.Tab();
518 if (nDz)
519 {
520 SCTAB nNewTab = rTab+nDz;
521 SCTAB nCount = rDoc.GetTableCount();
522 while (nNewTab<0) nNewTab = sal::static_int_cast<SCTAB>( nNewTab + nCount );
523 while (nNewTab>=nCount) nNewTab = sal::static_int_cast<SCTAB>( nNewTab - nCount );
524 rTab = nNewTab;
525 }
526 OSL_ENSURE( rCol>=rSource.aStart.Col() && rRow>=rSource.aStart.Row(),
527 "UpdateTranspose: pos. wrong" );
528
529 SCCOL nRelX = rCol - rSource.aStart.Col();
530 SCROW nRelY = rRow - rSource.aStart.Row();
531
532 rCol = static_cast<SCCOL>(static_cast<SCCOLROW>(rDest.Col()) +
533 static_cast<SCCOLROW>(nRelY));
534 rRow = static_cast<SCROW>(static_cast<SCCOLROW>(rDest.Row()) +
535 static_cast<SCCOLROW>(nRelX));
536}
537
539 const ScDocument& rDoc, const ScRange& rSource, const ScAddress& rDest, ScRange& rRef )
540{
542 // Only references in source range must be updated, i.e. no references in destination area.
543 // Otherwise existing references pointing to destination area will be wrongly transposed.
544 if (rSource.Contains(rRef))
545 {
546 // Source range contains the reference range.
547 SCCOL nCol1 = rRef.aStart.Col(), nCol2 = rRef.aEnd.Col();
548 SCROW nRow1 = rRef.aStart.Row(), nRow2 = rRef.aEnd.Row();
549 SCTAB nTab1 = rRef.aStart.Tab(), nTab2 = rRef.aEnd.Tab();
550 DoTranspose(nCol1, nRow1, nTab1, rDoc, rSource, rDest);
551 DoTranspose(nCol2, nRow2, nTab2, rDoc, rSource, rDest);
552 rRef.aStart = ScAddress(nCol1, nRow1, nTab1);
553 rRef.aEnd = ScAddress(nCol2, nRow2, nTab2);
554 eRet = UR_UPDATED;
555 }
556 return eRet;
557}
558
559// UpdateGrow - expands references which point exactly to the area
560// gets by without document
561
563 const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY, ScRange& rRef )
564{
566
567 // in y-direction the Ref may also start one row further below,
568 // if an area contains column heads
569
570 bool bUpdateX = ( nGrowX &&
571 rRef.aStart.Col() == rArea.aStart.Col() && rRef.aEnd.Col() == rArea.aEnd.Col() &&
572 rRef.aStart.Row() >= rArea.aStart.Row() && rRef.aEnd.Row() <= rArea.aEnd.Row() &&
573 rRef.aStart.Tab() >= rArea.aStart.Tab() && rRef.aEnd.Tab() <= rArea.aEnd.Tab() );
574 bool bUpdateY = ( nGrowY &&
575 rRef.aStart.Col() >= rArea.aStart.Col() && rRef.aEnd.Col() <= rArea.aEnd.Col() &&
576 (rRef.aStart.Row() == rArea.aStart.Row() || rRef.aStart.Row() == rArea.aStart.Row()+1) &&
577 rRef.aEnd.Row() == rArea.aEnd.Row() &&
578 rRef.aStart.Tab() >= rArea.aStart.Tab() && rRef.aEnd.Tab() <= rArea.aEnd.Tab() );
579
580 if ( bUpdateX )
581 {
582 rRef.aEnd.SetCol(sal::static_int_cast<SCCOL>(rRef.aEnd.Col() + nGrowX));
583 eRet = UR_UPDATED;
584 }
585 if ( bUpdateY )
586 {
587 rRef.aEnd.SetRow(sal::static_int_cast<SCROW>(rRef.aEnd.Row() + nGrowY));
588 eRet = UR_UPDATED;
589 }
590
591 return eRet;
592}
593
594/* 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:317
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:538
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:514
static void MoveRelWrap(const ScDocument &rDoc, const ScAddress &rPos, SCCOL nMaxCol, SCROW nMaxRow, ScComplexRefData &rRef)
Definition: refupdat.cxx:468
static ScRefUpdateRes UpdateGrow(const ScRange &rArea, SCCOL nGrowX, SCROW nGrowY, ScRange &rRef)
Definition: refupdat.cxx:562
int nCount
UpdateRefMode
Definition: global.hxx:300
@ URM_MOVE
Definition: global.hxx:303
@ URM_REORDER
Definition: global.hxx:304
@ URM_INSDEL
Definition: global.hxx:301
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