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 
32 void ScSingleRefData::InitAddress( SCCOL nColP, SCROW nRowP, SCTAB nTabP )
33 {
34  InitFlags();
35  mnCol = nColP;
36  mnRow = nRowP;
37  mnTab = nTabP;
38 }
39 
40 void 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 
49 void 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 
130 bool ScSingleRefData::Valid(const ScDocument& rDoc) const
131 {
132  return ColValid(rDoc) && RowValid(rDoc) && TabValid();
133 }
134 
135 bool ScSingleRefData::ColValid(const ScDocument& rDoc) const
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 
151 bool ScSingleRefData::RowValid(const ScDocument& rDoc) const
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 || MAXTAB < mnTab)
177  return false;
178  }
179 
180  return true;
181 }
182 
184 {
185  return ColValid(rDoc) && RowValid(rDoc) && mnTab >= -1;
186 }
187 
188 ScAddress ScSingleRefData::toAbs( const ScDocument& rDoc, const ScAddress& rPos ) const
189 {
190  return toAbs(rDoc.GetSheetLimits(), rPos);
191 }
192 
193 ScAddress 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 
213 void 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
363 void 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 
380 void 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 
478 bool 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 
488 ScRange ScComplexRefData::toAbs( const ScDocument& rDoc, const ScAddress& rPos ) const
489 {
490  return toAbs(rDoc.GetSheetLimits(), rPos);
491 }
492 
493 ScRange ScComplexRefData::toAbs( const ScSheetLimits& rLimits, const ScAddress& rPos ) const
494 {
495  return ScRange(Ref1.toAbs(rLimits, rPos), Ref2.toAbs(rLimits, rPos));
496 }
497 
498 void 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 
509 bool ScComplexRefData::IncEndColSticky( const ScDocument& rDoc, SCCOL nDelta, const ScAddress& rPos )
510 {
511  SCCOL nCol1 = Ref1.IsColRel() ? Ref1.Col() + rPos.Col() : Ref1.Col();
512  SCCOL nCol2 = Ref2.IsColRel() ? Ref2.Col() + rPos.Col() : Ref2.Col();
513  if (nCol1 >= nCol2)
514  {
515  // Less than two columns => not sticky.
516  Ref2.IncCol( nDelta);
517  return true;
518  }
519 
520  if (nCol2 == rDoc.MaxCol())
521  // already sticky
522  return false;
523 
524  if (nCol2 < rDoc.MaxCol())
525  {
526  SCCOL nCol = ::std::min( static_cast<SCCOL>(nCol2 + nDelta), rDoc.MaxCol());
527  if (Ref2.IsColRel())
528  Ref2.SetRelCol( nCol - rPos.Col());
529  else
530  Ref2.SetAbsCol( nCol);
531  }
532  else
533  Ref2.IncCol( nDelta); // was greater than rDoc.MaxCol(), caller should know...
534 
535  return true;
536 }
537 
538 bool ScComplexRefData::IncEndRowSticky( const ScDocument& rDoc, SCROW nDelta, const ScAddress& rPos )
539 {
540  SCROW nRow1 = Ref1.IsRowRel() ? Ref1.Row() + rPos.Row() : Ref1.Row();
541  SCROW nRow2 = Ref2.IsRowRel() ? Ref2.Row() + rPos.Row() : Ref2.Row();
542  if (nRow1 >= nRow2)
543  {
544  // Less than two rows => not sticky.
545  Ref2.IncRow( nDelta);
546  return true;
547  }
548 
549  if (nRow2 == rDoc.MaxRow())
550  // already sticky
551  return false;
552 
553  if (nRow2 < rDoc.MaxRow())
554  {
555  SCROW nRow = ::std::min( static_cast<SCROW>(nRow2 + nDelta), rDoc.MaxRow());
556  if (Ref2.IsRowRel())
557  Ref2.SetRelRow( nRow - rPos.Row());
558  else
559  Ref2.SetAbsRow( nRow);
560  }
561  else
562  Ref2.IncRow( nDelta); // was greater than rDoc.MaxRow(), caller should know...
563 
564  return true;
565 }
566 
568 {
569  return Ref1.IsDeleted() || Ref2.IsDeleted();
570 }
571 
572 #if DEBUG_FORMULA_COMPILER
573 void ScComplexRefData::Dump( int nIndent ) const
574 {
575  std::string aIndent;
576  for (int i = 0; i < nIndent; ++i)
577  aIndent += " ";
578 
579  cout << aIndent << "ref 1" << endl;
580  Ref1.Dump(nIndent+1);
581  cout << aIndent << "ref 2" << endl;
582  Ref2.Dump(nIndent+1);
583 }
584 #endif
585 
586 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool IsTabRel() const
Definition: refdata.hxx:70
SCCOL Col() const
Definition: refdata.cxx:247
void InitAddressRel(const ScDocument &rDoc, const ScAddress &rAdr, const ScAddress &rPos)
InitAddressRel: InitFlags and set address, everything relative to rPos.
Definition: refdata.cxx:40
bool IsTabDeleted() const
Definition: refdata.hxx:87
ScAddress aStart
Definition: address.hxx:500
SCROW Row() const
Definition: address.hxx:262
Flags
SC_DLLPUBLIC ScRange toAbs(const ScSheetLimits &rLimits, const ScAddress &rPos) const
Definition: refdata.cxx:493
bool Valid(const ScDocument &rDoc) const
Definition: refdata.cxx:130
Single reference (one address) into the sheet.
Definition: refdata.hxx:30
void InitFlags()
Definition: refdata.hxx:128
ScAddress toAbs(const ScSheetLimits &rLimits, const ScAddress &rPos) const
Definition: refdata.cxx:193
void SetRelCol(SCCOL nVal)
Definition: refdata.cxx:65
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 SetRelTab(SCTAB nVal)
Definition: refdata.cxx:99
bool operator==(const ScSingleRefData &) const
Definition: refdata.cxx:352
bool IncEndColSticky(const ScDocument &rDoc, SCCOL nDelta, const ScAddress &rPos)
Increment or decrement end column unless or until sticky.
Definition: refdata.cxx:509
ScAddress aEnd
Definition: address.hxx:501
void SetAbsRow(SCROW nVal)
Definition: refdata.cxx:76
void SetRowRel(bool bVal)
Definition: refdata.hxx:67
bool IsDeleted() const
Definition: refdata.cxx:125
void SetRowDeleted(bool bVal)
Definition: refdata.cxx:115
bool ColValid(const ScDocument &rDoc) const
Definition: refdata.cxx:135
SC_DLLPUBLIC SCROW MaxRow() const
Definition: document.hxx:873
void SetColDeleted(bool bVal)
Definition: refdata.cxx:110
SCTAB Tab() const
Definition: address.hxx:271
void SetTabRel(bool bVal)
Definition: refdata.hxx:69
void SetRow(SCROW nRowP)
Definition: address.hxx:275
bool IsColRel() const
Definition: refdata.hxx:66
void SetCol(SCCOL nColP)
Definition: address.hxx:279
void SetRelName(bool bVal)
Definition: refdata.hxx:92
bool IsRelTab() const
Definition: address.hxx:865
void SetRelRow(SCROW nVal)
Definition: refdata.cxx:82
void SetTab(SCTAB nTabP)
Definition: address.hxx:283
SC_DLLPUBLIC SCCOL MaxCol() const
Definition: document.hxx:872
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
int i
void SetFlag3D(bool bVal)
Definition: refdata.hxx:90
void InitAddress(const ScAddress &rAdr)
InitAddress: InitFlags and set address.
Definition: refdata.cxx:27
sal_Int16 SCCOL
Definition: types.hxx:22
bool RowValid(const ScDocument &rDoc) const
Definition: refdata.cxx:151
void SetAbsCol(SCCOL nVal)
Definition: refdata.cxx:59
ScSheetLimits & GetSheetLimits() const
Definition: document.hxx:874
ScSingleRefData Ref1
Definition: refdata.hxx:125
ScSingleRefData Ref2
Definition: refdata.hxx:126
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
bool IncEndRowSticky(const ScDocument &rDoc, SCROW nDelta, const ScAddress &rPos)
Increment or decrement end row unless or until sticky.
Definition: refdata.cxx:538
bool IsRowRel() const
Definition: refdata.hxx:68
void IncTab(SCTAB nInc)
Definition: refdata.cxx:105
const SCTAB MAXTAB
Definition: address.hxx:71
void SetAbsTab(SCTAB nVal)
Definition: refdata.cxx:93
SCTAB Tab() const
Definition: refdata.cxx:254
bool IsFlag3D() const
Definition: refdata.hxx:91
SCCOL Col() const
Definition: address.hxx:267
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
bool ValidRow(SCROW nRow) const
Definition: sheetlimits.hxx:40
bool TabValid() const
Definition: refdata.cxx:167
sal_Int32 SCROW
Definition: types.hxx:18
bool Valid(const ScDocument &rDoc) const
Definition: refdata.cxx:478
const ScAddress & GetAddress() const
Definition: address.hxx:888
unsigned char sal_uInt8
bool IsRelCol() const
Definition: address.hxx:857
bool IsRelRow() const
Definition: address.hxx:861
bool ValidCol(SCCOL nCol) const
Definition: sheetlimits.hxx:36
SvStream & endl(SvStream &rStr)
void InitFlags()
No default ctor, because used in ScRawToken union, set InitFlags!
Definition: refdata.hxx:55
struct ScSingleRefData::@35::@37 Flags
bool operator!=(const ScSingleRefData &) const
Definition: refdata.cxx:357
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
SCROW Row() const
Definition: refdata.cxx:240
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 IsDeleted() const
Definition: refdata.cxx:567
void SetAddress(const ScSheetLimits &rLimits, const ScAddress &rAddr, const ScAddress &rPos)
Definition: refdata.cxx:213
bool IsRelName() const
Definition: refdata.hxx:93
Complex reference (a range) into the sheet.
Definition: refdata.hxx:123
void IncRow(SCROW nInc)
Definition: refdata.cxx:88
sal_uInt8 mnFlagValue
Definition: refdata.hxx:39
SCTAB Tab() const
Definition: address.hxx:901
void PutInOrder(const ScAddress &rPos)
Adjust ordering (front-top-left/rear-bottom-right) to a new position.
Definition: refdata.cxx:504
void SetTabDeleted(bool bVal)
Definition: refdata.cxx:120
bool IsRowDeleted() const
Definition: refdata.hxx:85
void SetColRel(bool bVal)
Definition: refdata.hxx:65
bool ValidTab(SCTAB nTab)
Definition: address.hxx:105
sal_Int16 SCTAB
Definition: types.hxx:23
bool IsColDeleted() const
Definition: refdata.hxx:83
void IncCol(SCCOL nInc)
Definition: refdata.cxx:71
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