LibreOffice Module sc (master) 1
refdata.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 <sal/config.h>
21
22#include <algorithm>
23
24#include <refdata.hxx>
25#include <document.hxx>
26
28{
29 InitAddress( rAdr.Col(), rAdr.Row(), rAdr.Tab());
30}
31
32void ScSingleRefData::InitAddress( SCCOL nColP, SCROW nRowP, SCTAB nTabP )
33{
34 InitFlags();
35 mnCol = nColP;
36 mnRow = nRowP;
37 mnTab = nTabP;
38}
39
40void ScSingleRefData::InitAddressRel( const ScDocument& rDoc, const ScAddress& rAdr, const ScAddress& rPos )
41{
42 InitFlags();
43 SetColRel(true);
44 SetRowRel(true);
45 SetTabRel(true);
46 SetAddress(rDoc.GetSheetLimits(), rAdr, rPos);
47}
48
49void ScSingleRefData::InitFromRefAddress( const ScDocument& rDoc, const ScRefAddress& rRef, const ScAddress& rPos )
50{
51 InitFlags();
52 SetColRel( rRef.IsRelCol());
53 SetRowRel( rRef.IsRelRow());
54 SetTabRel( rRef.IsRelTab());
55 SetFlag3D( rRef.Tab() != rPos.Tab());
56 SetAddress( rDoc.GetSheetLimits(), rRef.GetAddress(), rPos);
57}
58
60{
61 Flags.bColRel = false;
62 mnCol = nVal;
63}
64
66{
67 Flags.bColRel = true;
68 mnCol = nVal;
69}
70
72{
73 mnCol += nInc;
74}
75
77{
78 Flags.bRowRel = false;
79 mnRow = nVal;
80}
81
83{
84 Flags.bRowRel = true;
85 mnRow = nVal;
86}
87
89{
90 mnRow += nInc;
91}
92
94{
95 Flags.bTabRel = false;
96 mnTab = nVal;
97}
98
100{
101 Flags.bTabRel = true;
102 mnTab = nVal;
103}
104
106{
107 mnTab += nInc;
108}
109
111{
112 Flags.bColDeleted = bVal;
113}
114
116{
117 Flags.bRowDeleted = bVal;
118}
119
121{
122 Flags.bTabDeleted = bVal;
123}
124
126{
127 return IsColDeleted() || IsRowDeleted() || IsTabDeleted();
128}
129
130bool ScSingleRefData::Valid(const ScDocument& rDoc) const
131{
132 return !IsDeleted() && ColValid(rDoc) && RowValid(rDoc) && TabValid(rDoc);
133}
134
136{
137 if (Flags.bColRel)
138 {
139 if (mnCol < -rDoc.MaxCol() || rDoc.MaxCol() < mnCol)
140 return false;
141 }
142 else
143 {
144 if (mnCol < 0 || rDoc.MaxCol() < mnCol)
145 return false;
146 }
147
148 return true;
149}
150
152{
153 if (Flags.bRowRel)
154 {
155 if (mnRow < -rDoc.MaxRow() || rDoc.MaxRow() < mnRow)
156 return false;
157 }
158 else
159 {
160 if (mnRow < 0 || rDoc.MaxRow() < mnRow)
161 return false;
162 }
163
164 return true;
165}
166
168{
169 if (Flags.bTabRel)
170 {
171 if (mnTab < -MAXTAB || MAXTAB < mnTab)
172 return false;
173 }
174 else
175 {
176 if (mnTab < 0 || rDoc.GetTableCount() <= mnTab)
177 return false;
178 }
179
180 return true;
181}
182
184{
185 return ColValid(rDoc) && RowValid(rDoc) && mnTab >= -1;
186}
187
188ScAddress ScSingleRefData::toAbs( const ScDocument& rDoc, const ScAddress& rPos ) const
189{
190 return toAbs(rDoc.GetSheetLimits(), rPos);
191}
192
193ScAddress ScSingleRefData::toAbs( const ScSheetLimits& rLimits, const ScAddress& rPos ) const
194{
195 SCCOL nRetCol = Flags.bColRel ? mnCol + rPos.Col() : mnCol;
196 SCROW nRetRow = Flags.bRowRel ? mnRow + rPos.Row() : mnRow;
197 SCTAB nRetTab = Flags.bTabRel ? mnTab + rPos.Tab() : mnTab;
198
200
201 if (rLimits.ValidCol(nRetCol))
202 aAbs.SetCol(nRetCol);
203
204 if (rLimits.ValidRow(nRetRow))
205 aAbs.SetRow(nRetRow);
206
207 if (ValidTab(nRetTab))
208 aAbs.SetTab(nRetTab);
209
210 return aAbs;
211}
212
213void ScSingleRefData::SetAddress( const ScSheetLimits& rLimits, const ScAddress& rAddr, const ScAddress& rPos )
214{
215 if (Flags.bColRel)
216 mnCol = rAddr.Col() - rPos.Col();
217 else
218 mnCol = rAddr.Col();
219
220 if (!rLimits.ValidCol(rAddr.Col()))
221 SetColDeleted(true);
222
223 if (Flags.bRowRel)
224 mnRow = rAddr.Row() - rPos.Row();
225 else
226 mnRow = rAddr.Row();
227
228 if (!rLimits.ValidRow(rAddr.Row()))
229 SetRowDeleted(true);
230
231 if (Flags.bTabRel)
232 mnTab = rAddr.Tab() - rPos.Tab();
233 else
234 mnTab = rAddr.Tab();
235
236 if (!ValidTab( rAddr.Tab(), MAXTAB))
237 SetTabDeleted(true);
238}
239
241{
242 if (Flags.bRowDeleted)
243 return -1;
244 return mnRow;
245}
246
248{
249 if (Flags.bColDeleted)
250 return -1;
251 return mnCol;
252}
253
255{
256 if (Flags.bTabDeleted)
257 return -1;
258 return mnTab;
259}
260
261// static
263{
264 const sal_uInt8 kCOL = 1;
265 const sal_uInt8 kROW = 2;
266 const sal_uInt8 kTAB = 4;
267
268 sal_uInt8 nRelState1 = rRef1.Flags.bRelName ?
269 ((rRef1.Flags.bTabRel ? kTAB : 0) |
270 (rRef1.Flags.bRowRel ? kROW : 0) |
271 (rRef1.Flags.bColRel ? kCOL : 0)) :
272 0;
273
274 sal_uInt8 nRelState2 = rRef2.Flags.bRelName ?
275 ((rRef2.Flags.bTabRel ? kTAB : 0) |
276 (rRef2.Flags.bRowRel ? kROW : 0) |
277 (rRef2.Flags.bColRel ? kCOL : 0)) :
278 0;
279
280 SCCOL nCol1 = rRef1.Flags.bColRel ? rPos.Col() + rRef1.mnCol : rRef1.mnCol;
281 SCCOL nCol2 = rRef2.Flags.bColRel ? rPos.Col() + rRef2.mnCol : rRef2.mnCol;
282 if (nCol2 < nCol1)
283 {
284 rRef1.mnCol = rRef2.Flags.bColRel ? nCol2 - rPos.Col() : nCol2;
285 rRef2.mnCol = rRef1.Flags.bColRel ? nCol1 - rPos.Col() : nCol1;
286 if (rRef1.Flags.bRelName && rRef1.Flags.bColRel)
287 nRelState2 |= kCOL;
288 else
289 nRelState2 &= ~kCOL;
290 if (rRef2.Flags.bRelName && rRef2.Flags.bColRel)
291 nRelState1 |= kCOL;
292 else
293 nRelState1 &= ~kCOL;
294 bool bTmp = rRef1.Flags.bColRel;
295 rRef1.Flags.bColRel = rRef2.Flags.bColRel;
296 rRef2.Flags.bColRel = bTmp;
297 bTmp = rRef1.Flags.bColDeleted;
298 rRef1.Flags.bColDeleted = rRef2.Flags.bColDeleted;
299 rRef2.Flags.bColDeleted = bTmp;
300 }
301
302 SCROW nRow1 = rRef1.Flags.bRowRel ? rPos.Row() + rRef1.mnRow : rRef1.mnRow;
303 SCROW nRow2 = rRef2.Flags.bRowRel ? rPos.Row() + rRef2.mnRow : rRef2.mnRow;
304 if (nRow2 < nRow1)
305 {
306 rRef1.mnRow = rRef2.Flags.bRowRel ? nRow2 - rPos.Row() : nRow2;
307 rRef2.mnRow = rRef1.Flags.bRowRel ? nRow1 - rPos.Row() : nRow1;
308 if (rRef1.Flags.bRelName && rRef1.Flags.bRowRel)
309 nRelState2 |= kROW;
310 else
311 nRelState2 &= ~kROW;
312 if (rRef2.Flags.bRelName && rRef2.Flags.bRowRel)
313 nRelState1 |= kROW;
314 else
315 nRelState1 &= ~kROW;
316 bool bTmp = rRef1.Flags.bRowRel;
317 rRef1.Flags.bRowRel = rRef2.Flags.bRowRel;
318 rRef2.Flags.bRowRel = bTmp;
319 bTmp = rRef1.Flags.bRowDeleted;
320 rRef1.Flags.bRowDeleted = rRef2.Flags.bRowDeleted;
321 rRef2.Flags.bRowDeleted = bTmp;
322 }
323
324 SCTAB nTab1 = rRef1.Flags.bTabRel ? rPos.Tab() + rRef1.mnTab : rRef1.mnTab;
325 SCTAB nTab2 = rRef2.Flags.bTabRel ? rPos.Tab() + rRef2.mnTab : rRef2.mnTab;
326 if (nTab2 < nTab1)
327 {
328 rRef1.mnTab = rRef2.Flags.bTabRel ? nTab2 - rPos.Tab() : nTab2;
329 rRef2.mnTab = rRef1.Flags.bTabRel ? nTab1 - rPos.Tab() : nTab1;
330 if (rRef1.Flags.bRelName && rRef1.Flags.bTabRel)
331 nRelState2 |= kTAB;
332 else
333 nRelState2 &= ~kTAB;
334 if (rRef2.Flags.bRelName && rRef2.Flags.bTabRel)
335 nRelState1 |= kTAB;
336 else
337 nRelState1 &= ~kTAB;
338 bool bTmp = rRef1.Flags.bTabRel;
339 rRef1.Flags.bTabRel = rRef2.Flags.bTabRel;
340 rRef2.Flags.bTabRel = bTmp;
341 bTmp = rRef1.Flags.bTabDeleted;
342 rRef1.Flags.bTabDeleted = rRef2.Flags.bTabDeleted;
343 rRef2.Flags.bTabDeleted = bTmp;
344 }
345
346 // bFlag3D stays the same on both references.
347
348 rRef1.Flags.bRelName = (nRelState1 != 0);
349 rRef2.Flags.bRelName = (nRelState2 != 0);
350}
351
353{
354 return mnFlagValue == r.mnFlagValue && mnCol == r.mnCol && mnRow == r.mnRow && mnTab == r.mnTab;
355}
356
358{
359 return !operator==(r);
360}
361
362#if DEBUG_FORMULA_COMPILER
363void ScSingleRefData::Dump( int nIndent ) const
364{
365 std::string aIndent;
366 for (int i = 0; i < nIndent; ++i)
367 aIndent += " ";
368
369 cout << aIndent << "address type column: " << (IsColRel()?"relative":"absolute")
370 << " row : " << (IsRowRel()?"relative":"absolute") << " sheet: "
371 << (IsTabRel()?"relative":"absolute") << endl;
372 cout << aIndent << "deleted column: " << (IsColDeleted()?"yes":"no")
373 << " row : " << (IsRowDeleted()?"yes":"no") << " sheet: "
374 << (IsTabDeleted()?"yes":"no") << endl;
375 cout << aIndent << "column: " << mnCol << " row: " << mnRow << " sheet: " << mnTab << endl;
376 cout << aIndent << "3d ref: " << (IsFlag3D()?"yes":"no") << endl;
377}
378#endif
379
380void ScComplexRefData::InitFromRefAddresses( const ScDocument& rDoc, const ScRefAddress& rRef1, const ScRefAddress& rRef2, const ScAddress& rPos )
381{
382 InitFlags();
383 Ref1.SetColRel( rRef1.IsRelCol());
384 Ref1.SetRowRel( rRef1.IsRelRow());
385 Ref1.SetTabRel( rRef1.IsRelTab());
386 Ref1.SetFlag3D( rRef1.Tab() != rPos.Tab() || rRef1.Tab() != rRef2.Tab());
387 Ref2.SetColRel( rRef2.IsRelCol());
388 Ref2.SetRowRel( rRef2.IsRelRow());
389 Ref2.SetTabRel( rRef2.IsRelTab());
390 Ref2.SetFlag3D( rRef1.Tab() != rRef2.Tab());
391 SetRange( rDoc.GetSheetLimits(), ScRange( rRef1.GetAddress(), rRef2.GetAddress()), rPos);
392}
393
395{
396 bool bInherit3D = (Ref1.IsFlag3D() && !Ref2.IsFlag3D() && !rRef.IsFlag3D());
397 ScRange aAbsRange = toAbs(rLimits, rPos);
398
399 ScSingleRefData aRef = rRef;
400 // If no sheet was given in the extending part, let it point to the same
401 // sheet as this reference's end point, inheriting the absolute/relative
402 // mode.
403 // [$]Sheet1.A5:A6:A7 on Sheet2 do still reference only Sheet1.
404 if (!rRef.IsFlag3D())
405 {
406 if (Ref2.IsTabRel())
407 aRef.SetRelTab( Ref2.Tab());
408 else
409 aRef.SetAbsTab( Ref2.Tab());
410 }
411 ScAddress aAbs = aRef.toAbs(rLimits, rPos);
412
413 if (aAbs.Col() < aAbsRange.aStart.Col())
414 aAbsRange.aStart.SetCol(aAbs.Col());
415
416 if (aAbs.Row() < aAbsRange.aStart.Row())
417 aAbsRange.aStart.SetRow(aAbs.Row());
418
419 if (aAbs.Tab() < aAbsRange.aStart.Tab())
420 aAbsRange.aStart.SetTab(aAbs.Tab());
421
422 if (aAbsRange.aEnd.Col() < aAbs.Col())
423 aAbsRange.aEnd.SetCol(aAbs.Col());
424
425 if (aAbsRange.aEnd.Row() < aAbs.Row())
426 aAbsRange.aEnd.SetRow(aAbs.Row());
427
428 if (aAbsRange.aEnd.Tab() < aAbs.Tab())
429 aAbsRange.aEnd.SetTab(aAbs.Tab());
430
431 // In Ref2 inherit absolute/relative addressing from the extending part.
432 // A$5:A5 => A$5:A$5:A5 => A$5:A5, and not A$5:A$5
433 // A$6:$A5 => A$6:A$6:$A5 => A5:$A$6
434 if (aAbsRange.aEnd.Col() == aAbs.Col())
435 Ref2.SetColRel( rRef.IsColRel());
436 if (aAbsRange.aEnd.Row() == aAbs.Row())
437 Ref2.SetRowRel( rRef.IsRowRel());
438
439 // In Ref1 inherit relative sheet from extending part if given.
440 if (aAbsRange.aStart.Tab() == aAbs.Tab() && rRef.IsFlag3D())
441 Ref1.SetTabRel( rRef.IsTabRel());
442
443 // In Ref2 inherit relative sheet from either Ref1 or extending part.
444 // Use the original 3D flags to determine which.
445 // $Sheet1.$A$5:$A$6 => $Sheet1.$A$5:$A$5:$A$6 => $Sheet1.$A$5:$A$6, and
446 // not $Sheet1.$A$5:Sheet1.$A$6 (with invisible second 3D, but relative).
447 if (aAbsRange.aEnd.Tab() == aAbs.Tab())
448 Ref2.SetTabRel( bInherit3D ? Ref1.IsTabRel() : rRef.IsTabRel());
449
450 // Force 3D flag in Ref1 if different sheet or more than one sheet
451 // referenced.
452 if (aAbsRange.aStart.Tab() != rPos.Tab() || aAbsRange.aStart.Tab() != aAbsRange.aEnd.Tab())
453 Ref1.SetFlag3D(true);
454
455 // Force 3D flag in Ref2 if more than one sheet referenced.
456 if (aAbsRange.aStart.Tab() != aAbsRange.aEnd.Tab())
457 Ref2.SetFlag3D(true);
458
459 // Inherit 3D flag in Ref1 from extending part in case range wasn't
460 // extended as in A5:A5:Sheet1.A5 if on Sheet1.
461 if (rRef.IsFlag3D())
462 Ref1.SetFlag3D( true);
463
464 // Inherit RelNameRef from extending part.
465 if (rRef.IsRelName())
466 Ref2.SetRelName(true);
467
468 SetRange(rLimits, aAbsRange, rPos);
469
470 return *this;
471}
472
474{
475 return Extend( rLimits, rRef.Ref1, rPos).Extend( rLimits, rRef.Ref2, rPos);
476}
477
478bool ScComplexRefData::Valid(const ScDocument& rDoc) const
479{
480 return Ref1.Valid(rDoc) && Ref2.Valid(rDoc);
481}
482
484{
485 return Ref1.ValidExternal(rDoc) && Ref2.ColValid(rDoc) && Ref2.RowValid(rDoc) && Ref1.Tab() <= Ref2.Tab();
486}
487
488ScRange ScComplexRefData::toAbs( const ScDocument& rDoc, const ScAddress& rPos ) const
489{
490 return toAbs(rDoc.GetSheetLimits(), rPos);
491}
492
493ScRange ScComplexRefData::toAbs( const ScSheetLimits& rLimits, const ScAddress& rPos ) const
494{
495 return ScRange(Ref1.toAbs(rLimits, rPos), Ref2.toAbs(rLimits, rPos));
496}
497
498void ScComplexRefData::SetRange( const ScSheetLimits& rLimits, const ScRange& rRange, const ScAddress& rPos )
499{
500 Ref1.SetAddress(rLimits, rRange.aStart, rPos);
501 Ref2.SetAddress(rLimits, rRange.aEnd, rPos);
502}
503
505{
507}
508
510{
511 // Both row anchors must be absolute.
512 return Ref1.Row() == 0 && Ref2.Row() == rLimits.MaxRow() && !Ref1.IsRowRel() && !Ref2.IsRowRel();
513}
514
517{
518 // Both column anchors must be absolute.
519 return Ref1.Col() == 0 && Ref2.Col() == rLimits.MaxCol() && !Ref1.IsColRel() && !Ref2.IsColRel();
520}
521
522bool ScComplexRefData::IncEndColSticky( const ScDocument& rDoc, SCCOL nDelta, const ScAddress& rPos )
523{
524 SCCOL nCol1 = Ref1.IsColRel() ? Ref1.Col() + rPos.Col() : Ref1.Col();
525 SCCOL nCol2 = Ref2.IsColRel() ? Ref2.Col() + rPos.Col() : Ref2.Col();
526 if (nCol1 >= nCol2)
527 {
528 // Less than two columns => not sticky.
529 Ref2.IncCol( nDelta);
530 return true;
531 }
532
533 if (nCol2 == rDoc.MaxCol())
534 // already sticky
535 return false;
536
537 if (nCol2 < rDoc.MaxCol())
538 {
539 SCCOL nCol = ::std::min( static_cast<SCCOL>(nCol2 + nDelta), rDoc.MaxCol());
540 if (Ref2.IsColRel())
541 Ref2.SetRelCol( nCol - rPos.Col());
542 else
543 Ref2.SetAbsCol( nCol);
544 }
545 else
546 Ref2.IncCol( nDelta); // was greater than rDoc.MaxCol(), caller should know...
547
548 return true;
549}
550
551bool ScComplexRefData::IncEndRowSticky( const ScDocument& rDoc, SCROW nDelta, const ScAddress& rPos )
552{
553 SCROW nRow1 = Ref1.IsRowRel() ? Ref1.Row() + rPos.Row() : Ref1.Row();
554 SCROW nRow2 = Ref2.IsRowRel() ? Ref2.Row() + rPos.Row() : Ref2.Row();
555 if (nRow1 >= nRow2)
556 {
557 // Less than two rows => not sticky.
558 Ref2.IncRow( nDelta);
559 return true;
560 }
561
562 if (nRow2 == rDoc.MaxRow())
563 // already sticky
564 return false;
565
566 if (nRow2 < rDoc.MaxRow())
567 {
568 SCROW nRow = ::std::min( static_cast<SCROW>(nRow2 + nDelta), rDoc.MaxRow());
569 if (Ref2.IsRowRel())
570 Ref2.SetRelRow( nRow - rPos.Row());
571 else
572 Ref2.SetAbsRow( nRow);
573 }
574 else
575 Ref2.IncRow( nDelta); // was greater than rDoc.MaxRow(), caller should know...
576
577 return true;
578}
579
581{
582 return Ref1.IsDeleted() || Ref2.IsDeleted();
583}
584
585#if DEBUG_FORMULA_COMPILER
586void ScComplexRefData::Dump( int nIndent ) const
587{
588 std::string aIndent;
589 for (int i = 0; i < nIndent; ++i)
590 aIndent += " ";
591
592 cout << aIndent << "ref 1" << endl;
593 Ref1.Dump(nIndent+1);
594 cout << aIndent << "ref 2" << endl;
595 Ref2.Dump(nIndent+1);
596}
597#endif
598
599/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool ValidTab(SCTAB nTab)
Definition: address.hxx:111
const SCTAB MAXTAB
Definition: address.hxx:70
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
@ INITIALIZE_INVALID
Definition: address.hxx:221
SCCOL Col() const
Definition: address.hxx:279
ScSheetLimits & GetSheetLimits() const
Definition: document.hxx:897
SC_DLLPUBLIC SCCOL MaxCol() const
Definition: document.hxx:891
SC_DLLPUBLIC SCROW MaxRow() const
Definition: document.hxx:892
SC_DLLPUBLIC SCTAB GetTableCount() const
Definition: document.cxx:316
ScAddress aEnd
Definition: address.hxx:498
ScAddress aStart
Definition: address.hxx:497
bool IsRelRow() const
Definition: address.hxx:854
const ScAddress & GetAddress() const
Definition: address.hxx:881
SCTAB Tab() const
Definition: address.hxx:894
bool IsRelTab() const
Definition: address.hxx:858
bool IsRelCol() const
Definition: address.hxx:850
int i
TOOLS_DLLPUBLIC SvStream & endl(SvStream &rStr)
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
bool Valid(const ScDocument &rDoc) const
Definition: refdata.cxx:478
void InitFlags()
Definition: refdata.hxx:128
ScSingleRefData Ref2
Definition: refdata.hxx:125
bool IsEntireRow(const ScSheetLimits &rLimits) const
Whether this references entire rows, 1:1.
Definition: refdata.cxx:516
bool IsDeleted() const
Definition: refdata.cxx:580
bool IncEndRowSticky(const ScDocument &rDoc, SCROW nDelta, const ScAddress &rPos)
Increment or decrement end row unless or until sticky.
Definition: refdata.cxx:551
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
bool ValidExternal(const ScDocument &rDoc) const
In external references nTab is -1 for the start tab and -1 for the end tab if one sheet and the exter...
Definition: refdata.cxx:483
bool IncEndColSticky(const ScDocument &rDoc, SCCOL nDelta, const ScAddress &rPos)
Increment or decrement end column unless or until sticky.
Definition: refdata.cxx:522
bool IsEntireCol(const ScSheetLimits &rLimits) const
Whether this references entire columns, A:A.
Definition: refdata.cxx:509
void InitFromRefAddresses(const ScDocument &rDoc, const ScRefAddress &rRef1, const ScRefAddress &rRef2, const ScAddress &rPos)
InitFlags and set range, relative to rPos if rRef1 and rRef2 say so.
Definition: refdata.cxx:380
ScComplexRefData & Extend(const ScSheetLimits &rLimits, const ScSingleRefData &rRef, const ScAddress &rPos)
Enlarge range if reference passed is not within existing range.
Definition: refdata.cxx:394
void PutInOrder(const ScAddress &rPos)
Adjust ordering (front-top-left/rear-bottom-right) to a new position.
Definition: refdata.cxx:504
ScSingleRefData Ref1
Definition: refdata.hxx:124
SCROW MaxRow() const
Definition: sheetlimits.hxx:62
bool ValidRow(SCROW nRow) const
Definition: sheetlimits.hxx:41
bool ValidCol(SCCOL nCol) const
Definition: sheetlimits.hxx:40
SCCOL MaxCol() const
Definition: sheetlimits.hxx:64
Single reference (one address) into the sheet.
Definition: refdata.hxx:30
void SetAbsCol(SCCOL nVal)
Definition: refdata.cxx:59
void SetAbsTab(SCTAB nVal)
Definition: refdata.cxx:93
SCCOL Col() const
Definition: refdata.cxx:247
void SetAddress(const ScSheetLimits &rLimits, const ScAddress &rAddr, const ScAddress &rPos)
Definition: refdata.cxx:213
void InitAddress(const ScAddress &rAdr)
InitAddress: InitFlags and set address.
Definition: refdata.cxx:27
bool IsDeleted() const
Definition: refdata.cxx:125
bool operator==(const ScSingleRefData &) const
Definition: refdata.cxx:352
bool IsRowDeleted() const
Definition: refdata.hxx:84
void IncRow(SCROW nInc)
Definition: refdata.cxx:88
void SetRowRel(bool bVal)
Definition: refdata.hxx:66
SCTAB Tab() const
Definition: refdata.cxx:254
void InitAddressRel(const ScDocument &rDoc, const ScAddress &rAdr, const ScAddress &rPos)
InitAddressRel: InitFlags and set address, everything relative to rPos.
Definition: refdata.cxx:40
void SetTabRel(bool bVal)
Definition: refdata.hxx:68
bool IsTabRel() const
Definition: refdata.hxx:69
SCROW Row() const
Definition: refdata.cxx:240
void SetColDeleted(bool bVal)
Definition: refdata.cxx:110
static void PutInOrder(ScSingleRefData &rRef1, ScSingleRefData &rRef2, const ScAddress &rPos)
Adjust ordering (front-top-left/rear-bottom-right) to a new position.
Definition: refdata.cxx:262
void SetRelRow(SCROW nVal)
Definition: refdata.cxx:82
bool IsRowRel() const
Definition: refdata.hxx:67
bool bTabDeleted
Definition: refdata.hxx:46
bool bColDeleted
Definition: refdata.hxx:42
void SetRelTab(SCTAB nVal)
Definition: refdata.cxx:99
bool Valid(const ScDocument &rDoc) const
Definition: refdata.cxx:130
ScAddress toAbs(const ScSheetLimits &rLimits, const ScAddress &rPos) const
Definition: refdata.cxx:193
bool IsColRel() const
Definition: refdata.hxx:65
bool RowValid(const ScDocument &rDoc) const
Definition: refdata.cxx:151
bool bRowDeleted
Definition: refdata.hxx:44
void IncCol(SCCOL nInc)
Definition: refdata.cxx:71
void SetAbsRow(SCROW nVal)
Definition: refdata.cxx:76
bool bRelName
Reference derived from RangeName with relative values.
Definition: refdata.hxx:48
void SetRelCol(SCCOL nVal)
Definition: refdata.cxx:65
struct ScSingleRefData::@34::@36 Flags
bool ColValid(const ScDocument &rDoc) const
Definition: refdata.cxx:135
bool IsTabDeleted() const
Definition: refdata.hxx:86
bool ValidExternal(const ScDocument &rDoc) const
In external references nTab is -1 if the external document was not loaded but the sheet was cached,...
Definition: refdata.cxx:183
void InitFromRefAddress(const ScDocument &rDoc, const ScRefAddress &rRef, const ScAddress &rPos)
InitFlags and set address, relative to rPos if rRef says so.
Definition: refdata.cxx:49
bool TabValid(const ScDocument &rDoc) const
Definition: refdata.cxx:167
void SetFlag3D(bool bVal)
Definition: refdata.hxx:89
void IncTab(SCTAB nInc)
Definition: refdata.cxx:105
bool operator!=(const ScSingleRefData &) const
Definition: refdata.cxx:357
bool IsFlag3D() const
Definition: refdata.hxx:90
void InitFlags()
No default ctor, because used in ScRawToken union, set InitFlags!
Definition: refdata.hxx:54
void SetRelName(bool bVal)
Definition: refdata.hxx:91
void SetRowDeleted(bool bVal)
Definition: refdata.cxx:115
bool IsColDeleted() const
Definition: refdata.hxx:82
void SetColRel(bool bVal)
Definition: refdata.hxx:64
sal_uInt8 mnFlagValue
Definition: refdata.hxx:38
bool IsRelName() const
Definition: refdata.hxx:92
void SetTabDeleted(bool bVal)
Definition: refdata.cxx:120
unsigned char sal_uInt8
sal_Int16 SCTAB
Definition: types.hxx:22
sal_Int16 SCCOL
Definition: types.hxx:21
sal_Int32 SCROW
Definition: types.hxx:17